日期:2014-05-16  浏览次数:20659 次

又出问题了 opencv的程序 还是不能运行
fedora16
编译方法一,编译成功,但是运行出错
[root@fulva c]# g++ `pkg-config --cflags opencv` -o onedr onedr.cpp `pkg-config --libs opencv`
[root@fulva c]# ./onedr
terminate called after throwing an instance of 'std::logic_error'
  what(): basic_string::_S_construct null not valid
Aborted (core dumped)


编译方法二,编译直接错误,我的系统里根本没有/usr/bin/ld这个目录
[root@fulva c]# g++ -L/usr/local/lib -I/usr/local/include/opencv -lhighgui -lcv onedr.cpp -o onedr
/usr/bin/ld: cannot find -lhighgui
/usr/bin/ld: cannot find -lcv
collect2: ld returned 1 exit status




------解决方案--------------------
/usr/bin/ld: cannot find -lhighgui
/usr/bin/ld: cannot find -lcv
请安装 libhighgui.so 与libcv.so


------解决方案--------------------
lz,你的第一一个编译方法没错,第二个编译方法只能在opencv1.*的版本上使用,

第一个编译方法的问题是应该是你的程序运行时没有参数吧 
./onedr file.png 加上你的图片
------解决方案--------------------
./onedr: error while loading shared libraries: libopencv_calib3d.so.2.4: cannot open shared object file: No such file or directory.2.4:
--------------------------------------

你的opencv make install了没有?
看看/usr/local/lib下面有没有libopencv_calib3d.so 之类的lib,这个是编译opencv后会产生的。