4

Possible Duplicate:
gcc linker errors on fedora: undefined reference

Since I've had trouble with the VC++ (a function overload that doesn't happen with gcc, since my project partner is programming on Linux), i switched to gcc on cygwin, but I am having trouble getting the programm running here too (him being able to compile the same code without any problems)

I am trying to compile with

$ gcc -I D:/Programme/Boost_Library/boost_1_51 ABI_new.cpp -o ABI

And afterwards I get a huge amount of errors like that:

/tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0xd): undefined reference to ´std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
    /tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0x60): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
    /tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0x9f): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
    /tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0xce): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'

I am not sure if this could have to do anything with the program not being able to read the input file apparently (indicated by the exit status), but I don't know, why that wouldn't work either, since - again - my colleague has no problems with exactly the same code.

I would really appreciate any tipps.

Community
  • 1
  • 1
Geus
  • 43
  • 3
  • 6
    Try compiling with `g++` instead of `gcc`. The latter might not know about the C++ standard library. – NPE Dec 15 '12 at 17:35

1 Answers1

5

Try compiling with g++ instead of gcc. The latter probably does not know about the C++ standard library, and is failing to instruct the linker to link it in.

NPE
  • 486,780
  • 108
  • 951
  • 1,012