未定义的引用`readVector(std :: __ cxx11 :: basic_string <char,std :: char_traits <char =“”>,std :: allocator <char>&gt;)&#39;

时间:2017-05-02 20:21:22

标签: c++ c++11

当我尝试编译代码时收到此错误消息:

  

c ++ -Ofast -march = native -DNDEBUG -std = c ++ 11 -Wc ++ 11-extensions -Wall matvec.o amath483.o Vector.o -o matvec

     

matvec.o:在函数0 == false; // true "" == false; // true NaN == false; // false 0 / 0 == false; // false 中readVector(std :: __ cxx11 :: basic_string,std :: allocator&gt;)&#39; clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)makefile:5:目标配方&#39; matvec&#39;失败了:*** [matvec]错误1

我的代码如下:

main': matvec.cpp:(.text+0x209): undefined reference to

1 个答案:

答案 0 :(得分:0)

显然,输入类型错误:std::string inputfile不是std::ifstreamstd::istream。您需要打开一个输入std::ifstream文件,其名称存储在inputfile中,然后将其传递给readVector

相关问题