【发布时间】:2014-07-27 06:09:00
【问题描述】:
我正在尝试使用gcc test.cpp -o test 编译和运行以下程序。但是我收到了这个错误:
In file included from test.cpp:4:
/usr/local/include/opencv/cvaux.hpp:49:10: error: 'cvaux.h' file not found with <angled>
include; use "quotes" instead
#include <cvaux.h>
^
1 error generated.
该行不在程序中。我能做些什么来纠正这个问题?
程序:
// Example showing how to read and write images
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.hpp>
int main(int argc, char** argv)
{
IplImage * pInpImg = 0;
// Load an image from file - change this based on your image name
pInpImg = cvLoadImage("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED);
if(!pInpImg)
{
fprintf(stderr, "failed to load input image\n");
return -1;
}
// Write the image to a file with a different name,
// using a different image format -- .png instead of .jpg
if( !cvSaveImage("my_image_copy.png", pInpImg) )
{
fprintf(stderr, "failed to write image file\n");
}
// Remember to free image memory after using it!
cvReleaseImage(&pInpImg);
return 0;
}
【问题讨论】:
-
请避免 any 代码,其中包含 IplImages 或使用 opencv/*** c-api 标头。这一切都已弃用,他们已经在 2010 年迁移到 c++。
-
这段代码是一个奇怪的组合。
.hpps 和cv2不都是 C++ 的吗?
标签: c++ opencv compiler-errors g++