Undefined Reference errors...

Ian Lance Taylor iant@google.com
Tue Jun 2 21:30:00 GMT 2009


russdot <russdot@gmail.com> writes:

> 3) Now, when I try to compile (on windows) the provided example main program
> using: g++ -L. main.cpp -lDataIO -o main.exe
> I get 'undefined reference' errors to functions that are defined in the
> library... Am I missing something or doing something wrong?

It is often not possible to link together C++ programs compiled with
different compilers.  This is because different C++ compilers tend to
use different ABIs and different symbol manglings.  This kind of thing
will only work if you restrict yourself to a C API written using extern
"C".

Ian



More information about the Gcc-help mailing list