简体   繁体   中英

VisualStudio FlyCapture2 SDK compilation errors

I am trying to develop a program using a Flea3 usb camera to capture video, but I am having some problems with the FlyCapture2 SDK.

I am using the latest SDK version (2.5) and Visual Studio 2012 Ultimate. I have added FlyCapture2\\bin64 to the path and linked VS to FlyCapture2\\lib64 and included FlyCapture2.lib as an external library.

This all compiles wonderfully. The problem arises when I #include <FlyCapture2.h> in main.cpp. This is the Error code I get:

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 ==========

I have looked at the header file and cannot frankly find anything wrong with it, plus I don't think a big company like them would send a faulty header file with their SDK. I believe it must be something with my VS settings because of the nature of the error print out. I have no idea what the problem is, any help or ideas would be appreciated.

Apparently I just needed to include windows.h to get rid of the compilation errors. Looked through some examples and just tried it and it worked.

I had similar error. It was resolved by defining WIN32 or using command line option /D "WIN32" . You can see it in FlyCapture2 SDK's examples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM