我正在尝试使用Flea3 USB摄像头开发一个程序来捕获视频,但我遇到了FlyCapture2 SDK的一些问题。
我使用的是最新的SDK版本(2.5)和Visual Studio 2012 Ultimate。 我已将FlyCapture2 \ bin64添加到路径中,并将VS链接到FlyCapture2 \ lib64,并将FlyCapture2.lib作为外部库包含在内。
这一切都很精彩。当我在main.cpp中#include <FlyCapture2.h>
时出现问题。
这是我得到的错误代码:
1>------ Build started: Project: cam_test, Configuration: Debug x64 ------
1> main.cpp
1>c:\flycapture2\include\Error.h(38): error C2059: syntax error : 'string'
1>c:\flycapture2\include\Error.h(39): error C2146: syntax error : missing ';' before identifier 'Error'
1>c:\flycapture2\include\Error.h(39): error C2470: 'Error' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\BusManager.h(56): error C2059: syntax error : 'string'
1>c:\flycapture2\include\BusManager.h(57): error C2146: syntax error : missing ';' before identifier 'BusManager'
1>c:\flycapture2\include\BusManager.h(57): error C2470: 'BusManager' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\CameraBase.h(47): error C2059: syntax error : 'string'
1>c:\flycapture2\include\CameraBase.h(48): error C2146: syntax error : missing ';' before identifier 'CameraBase'
1>c:\flycapture2\include\CameraBase.h(48): error C2470: 'CameraBase' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\Camera.h(40): error C2059: syntax error : 'string'
1>c:\flycapture2\include\Camera.h(40): error C2146: syntax error : missing ';' before identifier 'Camera'
1>c:\flycapture2\include\Camera.h(40): error C2470: 'Camera' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\Camera.h(40): error C2059: syntax error : 'public'
1>c:\flycapture2\include\GigECamera.h(38): error C2059: syntax error : 'string'
1>c:\flycapture2\include\GigECamera.h(38): error C2146: syntax error : missing ';' before identifier 'GigECamera'
1>c:\flycapture2\include\GigECamera.h(38): error C2470: 'GigECamera' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\GigECamera.h(38): error C2059: syntax error : 'public'
1>c:\flycapture2\include\Image.h(40): error C2059: syntax error : 'string'
1>c:\flycapture2\include\Image.h(41): error C2146: syntax error : missing ';' before identifier 'Image'
1>c:\flycapture2\include\Image.h(41): error C2143: syntax error : missing ';' before '{'
1>c:\flycapture2\include\Image.h(41): error C2447: '{' : missing function header (old-style formal list?)
1>c:\flycapture2\include\Utilities.h(104): error C2059: syntax error : 'string'
1>c:\flycapture2\include\Utilities.h(105): error C2146: syntax error : missing ';' before identifier 'Utilities'
1>c:\flycapture2\include\Utilities.h(105): error C2470: 'Utilities' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\AVIRecorder.h(37): error C2059: syntax error : 'string'
1>c:\flycapture2\include\AVIRecorder.h(38): error C2146: syntax error : missing ';' before identifier 'AVIRecorder'
1>c:\flycapture2\include\AVIRecorder.h(38): error C2470: 'AVIRecorder' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\flycapture2\include\TopologyNode.h(37): error C2059: syntax error : 'string'
1>c:\flycapture2\include\TopologyNode.h(38): error C2146: syntax error : missing ';' before identifier 'TopologyNode'
1>c:\flycapture2\include\TopologyNode.h(38): error C2143: syntax error : missing ';' before '{'
1>c:\flycapture2\include\TopologyNode.h(38): error C2447: '{' : missing function header (old-style formal list?)
1>c:\flycapture2\include\ImageStatistics.h(35): error C2059: syntax error : 'string'
1>c:\flycapture2\include\ImageStatistics.h(36): error C2146: syntax error : missing ';' before identifier 'ImageStatistics'
1>c:\flycapture2\include\ImageStatistics.h(36): error C2143: syntax error : missing ';' before '{'
1>c:\flycapture2\include\ImageStatistics.h(36): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我查看了头文件并且不能坦率地发现它有什么问题,而且我不认为像他们这样的大公司会用他们的SDK发送错误的头文件。我认为它必须与我的VS设置有关,因为错误打印的性质。 我不知道问题是什么,任何帮助或想法将不胜感激。
答案 0 :(得分:0)
显然我只需要包含windows.h来摆脱编译错误。看了一些例子,试了一下就行了。
答案 1 :(得分:0)
我有类似的错误。通过定义WIN32
或使用命令行选项/D "WIN32"
解决了这个问题。您可以在FlyCapture2 SDK的示例中看到它。