Talk:C++ Programming/Compiler/Linker/Libraries/Configuring Visual Studio

GCC/MinGW
Likely the include dir is already known, but that can be added with -I switch (e.g. -I/usr/local/include) to GCC. Other than that, you only need to include the library's .a (?) file with all the rest of the files when linking the app (not -l as you usually do for dynamic linking with shared libraries).

The following creates two object files (one.o and another.o) and then links the static library and the generated object files together to form the executable 'myapp'. g++ -c one.cpp -I/usr/local/include g++ -c another.cpp -I/usr/local/include g++ one.o another.o /usr/local/lib/libfoo.a -o myapp

Building static library involves generating the object files and then bundling them together with ar. Something like the following (creates libother.a from something.o and else.o object files). g++ -c something.cpp -I/usr/local/include g++ -c else.cpp -I/usr/local/include ar -rcs libother.a something.o else.o

--Acolyte of Discord 14:04, 6 May 2007 (UTC)