Link to home
Start Free TrialLog in
Avatar of ichigokurosaki
ichigokurosakiFlag for Afghanistan

asked on

[C/C++] How to add external library to Visual Studio 2010 (pgrflycapture, pointgrey)

I usually use to compile my C/C++ files under Linux by using g++ and by adding libraries reference from command line.

At the moment, i have to compile and build a Visual Studio 2010 Premium project and I do not know how to add external libraries because I never used it.

I have to compile a PointGrey project in order to acquire images from my pointgrey firewire camera and i'm trying to compile a working project downloaded from the pointgrey website.

The problem is that VS gives me this error:
1>LINK : fatal error LNK1104: cannot open file 'pgrflycapture.lib'

Cpp source file are in:
C:\Program Files\Point Grey Research\FlyCapture2\include
C:\Program Files\Point Grey Research\FlyCapture2\include\FC1
C:\Program Files\Point Grey Research\FlyCapture2\include\C

Library file are in:
C:\Program Files\Point Grey Research\FlyCapture2\lib
C:\Program Files\Point Grey Research\FlyCapture2\lib\FC1
C:\Program Files\Point Grey Research\FlyCapture2\lib\C

So, in VS, I modified the configuration in this way:

In Additional Include Directories (C/C++, General tab), I added:
C:\Program Files\Point Grey Research\FlyCapture2\lib\C;C:\Program Files\Point Grey Research\FlyCapture2\lib\FC1;C:\Program Files\Point Grey Research\FlyCapture2\lib;C:\Program Files\Point Grey Research\FlyCapture2\include\FC1;..\..\include;%(AdditionalIncludeDirectories)

In Additional Dependencies, there was already specified: pgrflycapture.lib

Can you help me to understand how to add the library reference, please?

I've attached some screenshots.
VS1.PNG
VS2.PNG
VS3.PNG
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ichigokurosaki

ASKER

Thanks a lot, jkr, as always your suggestion was correct!

Now, VS is able to find the libraries!

Unfortunately, it gives me this error:

1> File not found - MultipleCameraWriteToDiskEx.exe
1>  0 File copiati
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "xcopy /f/y "C:\Users\Rocco\Downloads\MultipleCameraWritetoDiskEx\Debug\MultipleCameraWriteToDiskEx.exe" ..\..\bin
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 4.
1>
1>Build FAILED.

Why this happens?
VS seems to be a little bit difficult to use for me!
I feel more comfortable with unix :(
I solved it!

It's was a path problem!

Thanks a lot, jkr!
perfect suggestion like always!
Thank you ;o)

Good that you sorted the last issue out.
Oh, one little correction, make that

#ifdef _MSC_VER // MS copilers only!
#pragma comment(lib,"mylib.lib")
#pragma comment(linker,"/LIBPATH:[PATH]")
#endif

Open in new window


instead...
Thanks again! :)

I'll add this tip to my notes in order to remember it! :)