1. 未定义标识符
修改:
2. errorLNK2019: 无法解析的外部符号 _cvHaarDetectObjects,该符号在函数"void __cdecl detect_and_draw(struct _IplImage *)"(?detect_and_draw@@YAXPAU_IplImage@@@Z) 中被引用的解决办法。
遇到这种问题一般都是由于缺少相应的库文件:
右击项目,选择“属性”--“链接器”--“输入”--“附加依赖项”
根据错误中的提示在下图右边的红色框内添加相应的lib文件
3.
对于VS2010编译程序时出现的错误
对于这样的错误:
win32.exe': Loaded 'C:\Windows\System32\msvcr100d.dll',Symbols loaded.
'win32.exe': Loaded'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'win32.exe': Loaded 'C:\Windows\System32\msctf.dll',Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'win32.exe': Loaded'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
修改:
解决方案为工具-->选项-->调试-->符号
如果不是想debug,则该问题可以无视
如果确定要debug,请按该流程操作:
1.工具->选项->调试->符号:
2.勾选Microsoft符号服务器,点击确定,然后按照第一步步骤再次点开该对话框,这时下面一栏的“在此目录下缓存符号”中会自动填充一个目录路径,复制该路径,
3.在“Microsoft符号服务器”所在列表中添加一项,内容是上一步复制的路径,点击确定
4.debug,系统会从官方服务器下载符号缓存
5.完成后按照第一步步骤再次打开对话框,将“Microsoft符号服务器”选项前的复选框取消勾选,将新添加的那一项前的复选框勾选,点击确定。
这时再次debug就不会再次从服务器下载了。
还有对于像这样的程序
本身是没有错的,只不过编译运行后,你会发现在调试窗口出现如下内容: 已加载“C:\Windows\System32\ntdll.dll”,已加载符号(去除源信息)。
已加载“C:\Windows\System32\kernel32.dll”,已加载符号(去除源信息)。
已加载“C:\Windows\System32\KernelBase.dll”,已加载符号(去除源信息)。
而debug窗口会随着你按下的回车键而消失。其实是运行结果出来了,一闪而过而已。
不信试试加whlie(1),或者在main函数下的return 0 之前加上 system("pause");你就会看到你要的结果
4.error C4430: 缺少类型说明符 - 假定为 int。
注意: C++ 不支持默认 int 错误的解决方法
一些函数定义中,在VC6中,如果没有显示的指定返回值类型,编译器将其视为默认整型;但是vs2008/vs2010不支持默认整型,解决这个问题不能修改每个没有显示指示返回值类型的函数地方,可以用排除4430来解决;具体的在打开project->BaseClasses properties->configuration->C/C++->Advance中禁用特定警告中排除4430即可。
5.error C2146: 语法错误 : 缺少“;”(在标识符“filter”的前面)
解决办法:把CvFilter filter = CV_GAUSSIAN_5x5;注释掉, 后面根本就没用到
把CVFILTER 直接改成int 就行了 opencv高级版本没有这个类型了
6.error C3861: “cvPyrSegmentation”: 找不到标识符
解决:
添加如下语句即可:
#include
对应的库:\OpenCV246\build\x64\vc11\lib\opencv_legacy246d.lib
7.error C1083: 无法打开包括文件:“cxtypes.h”: No suchfile or directory
解决:将#include
改成
#include"cv.h"
#include "cxcore.h"
#include "highgui.h"
估计就是版本改导致这个问题~
我早opencv2.2遇到的,之前1.0还有呢~
8.无法打开包括文件”stadfx.h”
解决:新建项目的时候不要建立空项目,要使用预编译头