error: In function ‘void* opencv_showimg(void*)’:

时间:2023-03-10 07:25:40
error: In function ‘void* opencv_showimg(void*)’:

今天这个问题折磨了我一下午,终于知道是为什么了,心酸历程。。。。。赶紧来记录一下

错误:

/home/wj/workspace/Loitor_VI_Sensor_SDK_V1./SDK/src/camtest2.cpp: In function ‘void* opencv_showimg(void*)’:
/home/wj/workspace/Loitor_VI_Sensor_SDK_V1./SDK/src/camtest2.cpp::: error: ‘imshow’ was not declared in this scope
imshow("left",img_left);
^
/home/wj/workspace/Loitor_VI_Sensor_SDK_V1./SDK/src/camtest2.cpp::: error: ‘imshow’ was not declared in this scope
imshow("right",img_right);
^
/home/wj/workspace/Loitor_VI_Sensor_SDK_V1./SDK/src/camtest2.cpp::: error: ‘imshow’ was not declared in this scope
imshow("left",img_left);
^
make[]: *** [CMakeFiles/camtest2.dir/src/camtest2.cpp.o] Error
make[]: *** [CMakeFiles/camtest2.dir/all] Error
make: *** [all] Error

出现这种问题的时候,一般是头文件不对,查一下你库存放的位置,版本不同 #include 后面写的是不同。

他原来的程序是

#include <cv.h>
#include <highgui.h>

而我的头文件是

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

这样修改就好了。。。所以写成自己的才能调用成功。。。。。