我正在尝试开发一个使用SDK摄像头来捕获视频的程序,但我在使用FlyCapture2 Flea3时遇到了一些问题。
我使用的是最新的SDK版本(2.5)和Visual Studio 2012旗舰版。我已经将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设置有关,因为打印输出的错误的性质。我不知道是什么问题,任何帮助或想法将不胜感激。
发布于 2013-07-11 15:35:06
显然,我只需要包含windows.h就可以消除编译错误。查看了一些示例,并尝试了一下,它起作用了。
发布于 2014-07-13 07:41:33
我也有过类似的错误。已通过定义WIN32或使用命令行选项/D "WIN32"解决了此问题。您可以在FlyCapture2 SDK的示例中看到它。
https://stackoverflow.com/questions/17587354
复制相似问题