eclipse gcc,都报undefined reference to ...

IranCyberArmy 2013-04-10 05:23:24
我看了,是用函数参数用const string&的地方报的,

网上看了,说是用g++而不是gcc,但我用的就是g++啊
FindFiles .h文件
class FindFiles {
public:
void Search(const std::string& dir);
};

main文件里include了FindFiles.h
main函数里调用了Search函数,就显示string这里有问题.
但是我在main函数里直接用string没事.
...全文
305 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
IranCyberArmy 2013-04-10
  • 打赏
  • 举报
回复
我原来问过人,为什么linux上大多用C语言开发,而不是C++. 有人说了,除了效率的考虑,更重要的一点,linux上没有好的C++编译器. 我现在算是体会到了,同样的代码,一会儿行,一会儿不行的. 把这段代码放到VS下,根本不用考虑Makefile文件怎么写,一点就编译通过了.
IranCyberArmy 2013-04-10
  • 打赏
  • 举报
回复
引用 3 楼 vuqrzk5w 的回复:
http://stackoverflow.com/questions/3656050/c-undefined-reference-to-foofoostdstring
这招果然成功了,不是为什么呢?那我用eclipse,不用命令行,又该怎么办呢?
vuqrzk5w 2013-04-10
  • 打赏
  • 举报
回复
http://stackoverflow.com/questions/3656050/c-undefined-reference-to-foofoostdstring
图灵狗 2013-04-10
  • 打赏
  • 举报
回复
#include "FindFiles.h"之前有#include <string>吗?
引用 楼主 IranCyberArmy 的回复:
我看了,是用函数参数用const string&的地方报的, 网上看了,说是用g++而不是gcc,但我用的就是g++啊 FindFiles .h文件 C/C++ code?1234class FindFiles {public: void Search(const std::string& dir);}; main文件里include了F……
vuqrzk5w 2013-04-10
  • 打赏
  • 举报
回复
http://cplusplus.syntaxerrors.info/index.php?title=Undefined_reference_to_%60std::basic_string(char,_std::char_traits(char),_std::allocator(char))::basic_string()'

64,645

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧