Take the 2-minute tour ×  I've just set up MinGW environment
following this post  But how to add 3rd party libraries to it?
share|improve this question add comment  3 Answers  up vote 3
down vote accepted  A library consists of two main components -
the C header files and the compiled object code archive. GCC has
a bewildering array of ways of specifying these things, but
let's say you are using a library foo.a which lives in the
relative directory path foo/lib, and a header foo.h which lives
in foo/inc. Your own C code lives in main.c and looks like this:
#include "foo.h" int main() {   return FooFunc();    // call
function in foo.a  To compile this, you could use the command
line:  gcc main.c -Ifoo/inc foo/lib/foo.a -o main.exe  the -I
flag adds to the path searched for headers. You can also add to
the lib path, but then things start to get complicated :-)
share|improve this answer +1,it's helpful!But can you make it
more general?Say if I want to include 2 libraries from two
different directories.BTW,see