0

我正在尝试使用 Flea3 usb 摄像头开发一个程序来捕获视频,但我在使用 FlyCapture2 SDK 时遇到了一些问题。

我正在使用最新的 SDK 版本 (2.5) 和 Visual Studio 2012 Ultimate。我已将 FlyCapture2\bin64 添加到路径并将 VS 链接到 FlyCapture2\lib64 并将 FlyCapture2.lib 作为外部库包含在内。

这一切都编译得很好。当我#include <FlyCapture2.h>在 main.cpp 中时出现问题。这是我得到的错误代码:

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 设置有关。我不知道问题是什么,任何帮助或想法将不胜感激。

4

2 回答 2

0

显然我只需要包含 windows.h 就可以摆脱编译错误。查看了一些示例并尝试了它并且它有效。

于 2013-07-11T07:35:06.380 回答
0

我有类似的错误。它是通过定义WIN32或使用命令行选项来解决的/D "WIN32"。您可以在 FlyCapture2 SDK 的示例中看到它。

于 2014-07-12T23:41:33.203 回答