Я не эксперт по C ++ или Linux, но мне поручили проект, в котором мне нужно скомпилировать приложение opencv, которое должно быть скомпилировано с использованием файлов bjam, jamroot и famfile …
Однако, когда я использую imshow (window_name, frame); функция opencv я получаю следующие ошибки во время компиляции
**** Build of configuration Default for project viostream-exported ****
make all
#bjam FaceDetector variant=release link=static toolset=gcc -q -j 3
bjam test_viostream variant=release link=static toolset=gcc -q -j 3
...found 208 targets...
...updating 1 target...
gcc.link test/bin/gcc-4.6/release/link-static/test_viostream
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libopencv_highgui.a(window_gtk.o): In function `icvOnTrackbar(_GtkWidget*, void*)':
(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0x15): undefined reference to `gtk_range_get_type'
make: *** [all] Error 1
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libopencv_highgui.a(window_gtk.o): In function `icvOnTrackbar(_GtkWidget*, void*)':
(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0x20): undefined reference to `g_type_check_instance_cast'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libopencv_highgui.a(window_gtk.o): In function `icvOnTrackbar(_GtkWidget*, void*)':
(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0x28): undefined reference to `gtk_range_get_value'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libopencv_highgui.a(window_gtk.o): In function `icvWindowThreadLoop()':
(.text._ZL19icvWindowThreadLoopv+0x10): undefined reference to `g_mutex_lock'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libopencv_highgui.a(window_gtk.o): In function `icvWindowThreadLoop()':
(.text._ZL19icvWindowThreadLoopv+0x17): undefined reference to `gtk_main_iteration_do'
.........................blah blah blah blah blah ............................
...........................................................
"g++" -o "test/bin/gcc-4.6/release/link-static/test_viostream" -Wl,--start-group "test/bin/gcc-4.6/release/link-static/test_viostream.o" "/home/Desktop/viostream-exported/viostream/bin/gcc-4.6/release/link-static/libviostream.a" -Wl,-Bstatic -lopencv_flann -lopencv_legacy -lopencv_contrib -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_video -lopencv_ml -lopencv_highgui -lopencv_imgproc -lopencv_core -lfreetype -lboost_chrono -lboost_thread -lboost_program_options -lboost_filesystem -lboost_system -Wl,-Bdynamic -lswscale -lavdevice -lavcodec -lavformat -lavutil -lGLEW -lglut -lGL -lmgl -lz -lpthread -Wl,--end-group...failed gcc.link test/bin/gcc-4.6/release/link-static/test_viostream...
...failed updating 1 target...
Есть идеи?
p.s
это то, что я написал в проекте jamfile
exe test_viostream
: $(path_viostream)//viostream
test_viostream.cpp
:
<include>$(path_vocr)
<include>$(path_ma)
<include>$(path_viostream)
<include>$(path_singularity)
<include>/usr/include/freetype2
<include>/usr/include/opencv
: <cxxflags>-std=c++0x
;
я также объявляю библиотеку opencv следующим образом в jamfile
lib opencv_core : : <name>opencv_core ;
lib opencv_imgproc : : <name>opencv_imgproc ;
lib opencv_highgui : : <name>opencv_highgui ;
lib opencv_ml : : <name>opencv_ml ;
lib opencv_video : : <name>opencv_video ;
lib opencv_features2d : : <name>opencv_features2d ;
lib opencv_calib3d : : <name>opencv_calib3d ;
lib opencv_objdetect : : <name>opencv_objdetect ;
lib opencv_contrib : : <name>opencv_contrib ;
lib opencv_legacy : : <name>opencv_legacy ;
lib opencv_flann : : <name>opencv_flann ;
alias opencv : opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann ;
Я нашел решение …
Мне просто нужно было изменить объявление библиотеки opencv следующим образом:
lib opencv_core : : <name>opencv_core <link>shared ;
lib opencv_imgproc : : <name>opencv_imgproc <link>shared ;
lib opencv_highgui : : <name>opencv_highgui <link>shared ;
lib opencv_ml : : <name>opencv_ml <link>shared ;
lib opencv_video : : <name>opencv_video <link>shared ;
lib opencv_features2d : : <name>opencv_features2d <link>shared ;
lib opencv_calib3d : : <name>opencv_calib3d <link>shared ;
lib opencv_objdetect : : <name>opencv_objdetect <link>shared ;
lib opencv_contrib : : <name>opencv_contrib <link>shared ;
lib opencv_legacy : : <name>opencv_legacy <link>shared ;
lib opencv_flann : : <name>opencv_flann <link>shared ;
alias opencv : opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann ;
Других решений пока нет …