views:

34

answers:

1

Hello guys,

I've cross-compiled a library called Adol-c on linux for windows (mingw). It seems to be ok, but when I try to link this new cross-compiled library (libadolc.a) in my project on windows i find the following problems:


g++ -LC:\1500TB\libs\Cross-ADOL-C-2.1.0\adolc_base\lib -mwindows -oteste.exe src\main.o -ladolc -lstdc++ -lm C:\1500TB\libs\Cross-ADOL-C-2.1.0\adolc_base\lib/libadolc.a(adouble.o): In function ZNSirsERd': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/istream:219: undefined reference tostd::istream& std::istream::_M_extract(double&)' C:\1500TB\libs\Cross-ADOL-C-2.1.0\adolc_base\lib/libadolc.a(adouble.o): In function ZNSolsEd': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ostream:214: undefined reference tostd::ostream& std::ostream::_M_insert(double)' C:\1500TB\libs\Cross-ADOL-C-2.1.0\adolc_base\lib/libadolc.a(adouble.o): In function operator<< <std::char_traits<char> >': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ostream:517: undefined reference tostd::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, int)'


if I am correct, libadolc.a is looking for includes in my linux directory.. I don't understand what I did wrong, maybe something while I was compiling the library? should I change something?

I thank you in advance,

A: 

It's not looking for includes, but the linker is looking for the standard library iostreams functionality. It does look like the linker can't find the C++ runtime libraries, and it also looks like you did specify those on the command line - I'd take that off (g++ should find them by itself), verify that libstdc++.a/.so is where the compiler expects it to be an try again.

If this is the first project you compile with mingw chances are that the environment isn't set up 100% correctly.

Timo Geusch
The environment is ok, I use to compile other programs with mingw on eclipse for windows. The include paths are all set to windows mingw directories but nevertheless g++ still tries to find the libraries on linux