今天新建了一个工程打算把OpenCV的头文件和库文件放到工程文件夹中使用,以便今后拷贝只拷工程文件夹,不用安装OpenCV。

在 #include "stdafx.h" 里添加库函数

1 #pragma comment(lib,".//lib//cv.lib")
2 #pragma comment(lib,".//lib//cxcore.lib")
3 #pragma comment(lib,".//lib//highgui.lib")

图像处理类里添加头文件,头文件和库文件都是用相对路径

1 #include "./include/cv.h"
2 #include "./include/cxcore.h"
3 #include "./include/highgui.h"

编译的时候发现了一个错误:

fatal error C1010: unexpected end of file while looking for precompiled header directive

google别人的解决方法:

1、右键点工程名,选设置,然后选c/c++属性页,再选catagory选单中选 precompiled header ,将选项置成no use 或者autometic。

2、如果使用的是Win32工程,可能就是错误文件没有包含:#include "stdafx.h",添加该包含即可。

我使用方法2解决,类源文件需包含 #include "stdafx.h",而类的头文件不用包含。具体见stdafx.h、stdafx.cpp的作用

相关文章:

  • 2022-01-31
  • 2021-12-19
  • 2021-06-11
  • 2022-12-23
  • 2021-06-03
  • 2021-07-08
猜你喜欢
  • 2021-09-04
  • 2021-05-18
  • 2022-12-23
  • 2021-09-12
  • 2021-11-16
  • 2022-12-23
相关资源
相似解决方案