Adding a library confuses the compiler :(

Hello.

I am trying to write a simple cpp code using an external API.
I am having issues with the compiling syntax.
When adding a library, which quotes should I use ? ", ', < ?
should I add it in the 3 different options:
- C++ compiler/includes (-I)
- C++ linker / libraries (-l)
- c++ library search path (-L)

?

I use Eclipse 3.5 / win7 64 / mingw.

here is the result of the compiler:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
**** Build of configuration Debug for project FindUSBDevices0 ****

**** Internal Builder is used for build               ****
g++ -IC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\/firmware/u3p_firmware/inc -I..\. -I. -IC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\/library/cpp/lib/x86 -IC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\/library/cpp/inc -IC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\/library/cpp -O0 -g3 -Wall -c -fmessage-length=0 -osrc\FindDevices0.o ..\src\FindDevices0.cpp
..\src\FindDevices0.cpp: In function 'int main()':
..\src\FindDevices0.cpp:27:6: warning: unused variable 'a' [-Wunused-variable]
  int a;
      ^
g++ -LC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\library\cpp\lib\x86\ -oFindUSBDevices0.exe src\FindDevices0.o -lC:\Program Files\Cypress\EZ-USB FX3 SDK\1.2\library\cpp\lib\x86\CyAPI
g++: fatal error: no input files
compilation terminated.
Build error occurred, build is stopped
Time consumed: 943  ms.  


you should add the absolute path to your library to your path variable on your computer. Use this http://www.java.com/en/download/help/path.xml

Personally I've only worked with header files so there is no need for the above procedure; because you just have to have the header file in the same directory of your main project then to include it, you use:

#include "myheader.h"

And yes the extension of the file has to be .h

GCC tutorial on linking libraries: http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html
Last edited on
Topic archived. No new replies allowed.