I am using the Eclipse CDT plugin to write simple C programs, and no where in the documentation can I find info on how to:
- Import C standard libraries such as
assert.h
, etc. - Import non-standard, 3rd party libraries, such as
glib
, or even perhaps my own local libraries
In Java-land, to add a jar/lib to your project's build/compile path, one solution is to copy the jar into a lib/
directory inside the project, right-click it, and then go to Build Path >> Add to Build Path
. I'm wondering what the equivalent is for C programs with CDT?
From http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_add_an_external_library_to_my_C.2B.2B_project.3F
For includes: right click on your project and go to Properties>>C/C++ Build>>Settings>>GCC C++ Compiler >> Includes
you must add the include path for the external library (where the header reside). This information is needed by the Eclipse indexer (code completion etc.) and the compiler
For libraries: right click on your project and go to Properties>>C/C++ Build>>Settings>>GCC C++ Linker >> Libraries you must add the library search path (option -L) and the library you want to link against (option -l). This info is needed for the linker.