可能重複:
gcc linker errors on fedora: undefined reference「未定義的引用」(工作在Linux,但不能使用Cygwin在Windows上)
自從我遇到了麻煩與VC++(函數重載這不會發生在gcc上,因爲我的項目合作伙伴在Linux上進行編程),我在cygwin上切換到了gcc,但是我也無法在這裏運行程序(他可以毫無問題地編譯相同的代碼)
我試圖用
$ gcc -I D:/Programme/Boost_Library/boost_1_51 ABI_new.cpp -o ABI
,又重新編譯,我得到了巨大的誤差的大小類似:
/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'
我不知道這是否可能有不被程序做任何事情能夠顯然讀取輸入文件(由退出狀態指示),但我不知道,爲什麼這也不起作用,因爲 - 同樣 - 我的同事對於完全相同的代碼沒有問題。
我真的很感激任何tipps。
嘗試使用'g ++'而不是'gcc'進行編譯。後者可能不知道C++標準庫。 – NPE