I\'m making a C++ Shared Library and when I compile a main exe that uses the library the compiler gives me:
main.cpp:(.text+0x21): undefined reference to `Fo
g++ -I. -L. -lfoo main.cpp -o main
is the problem. Recent versions of GCC require that you put the object files and libraries in the order that they depend on each other - as a consequential rule of thumb, you have to put the library flags as the last switch for the linker; i. e., write
g++ -I. -L. main.cpp -o main -lfoo
instead.