I have some simple code using Point Gray's FlyCapture libraries:
#include <iostream>
#include "FlyCapture2.h"
using namespace std;
int main(){
cout << "Hello World!";
FlyCapture2::BusManager m;
return 0;
}
The above code gives these link error at compile time:
1>------ Build started: Project: CJMVideo, Configuration: Release Win32 ------
1>Compiling...
1>CJMVideo.cpp
1>Linking...
1>CJMVideo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::BusManager::~BusManager(void)" (__imp_??1BusManager@FlyCapture2@@UAE@XZ)
1>CJMVideo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::BusManager::BusManager(void)" (__imp_??0BusManager@FlyCapture2@@QAE@XZ)
1>C:\Users\Akihiro\Documents\Visual Studio 2008\Projects\CJM开发者_StackOverflowVideo\Release\CJMVideo.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\Akihiro\Documents\Visual Studio 2008\Projects\CJMVideo\CJMVideo\Release\BuildLog.htm"
1>CJMVideo - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have added FlyCapture's directory as a library directory in VS2008's options, and I have added the libraries as additional dependencies under project settings.
What is my next step to debug? I am at a loss.
Thanks,
@Surgio:
I solved my problem, so I thought I'd give you an update. My issue turned out to be that my Visual Studio was using a 32 bit compiler but trying to compile from 64 bit libraries.
You probably did this, but just case, make sure you (1) added the libraries locations in VS and (2) make sure you added the libraries as additional dependencies under your project settings.
In your Visual Studio properties, make sure the compiler knows where the additional library directories live, otherwise the likelihood is that you will get the linker errors you have described.
Specifically you do this by setting the Project Properties -> Linker -> General -> Additional Library Directories. You need to tell it where the library directory lives. For a FlyCapture SDK v2.2 installation for example, this is commonly in:
C:\Program Files\Point Grey Research\FlyCapture2\lib
One other thing, even if you are working in a 64-bit platform, if for example you choose to run your FlyCapture application as a Win32 console, you will probably still need to download and use the 32-bit version of whatever FlyCapture SDK you are using, not the 64-bit version. Just a thought.
See this blog posting for a more detailed explanation of getting started with FlyCapture setups, which at the time was done in VS2008 in a Windows XP 32-bit environment, but it shouldn't be too difficult to apply this to 64-bit on more recent versions of Visual Studio. Any feedback much appreciated.
精彩评论