【发布时间】:2012-12-15 17:32:25
【问题描述】:
由于我在使用 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'
我不确定这是否与程序显然无法读取输入文件有关(由退出状态指示),但我不知道为什么这也不起作用,因为- 再次 - 我的同事对完全相同的代码没有任何问题。
如果有任何提示,我将不胜感激。
【问题讨论】:
-
尝试使用
g++而不是gcc进行编译。后者可能不知道 C++ 标准库。
标签: c++ boost reference cygwin undefined