pezy / CppPrimer

:books: Solutions for C++ Primer 5th exercises.
http://dwz.cn/cp5answer
Creative Commons Zero v1.0 Universal
3.29k stars 1.44k forks source link

请问下,我编译ex8_6.cpp报错,代码拷贝跟您一样的也报错 #102

Closed likui911 closed 7 years ago

likui911 commented 7 years ago

d:/Source/CppPrimer/chapter08/ex8_6.cpp:15: undefined reference to read(std::istream&, Sales_data&)' d:/Source/CppPrimer/chapter08/ex8_6.cpp:17: undefined reference toread(std::istream&, Sales_data&)' d:/Source/CppPrimer/chapter08/ex8_6.cpp:19: undefined reference to Sales_data::combine(Sales_data const&)' d:/Source/CppPrimer/chapter08/ex8_6.cpp:21: undefined reference toprint(std::ostream&, Sales_data const&)' d:/Source/CppPrimer/chapter08/ex8_6.cpp:25: undefined reference to `print(std::ostream&, Sales_data const&)'

pezy commented 7 years ago

你有这句吗?

include "../ch07/ex7_26.h"

路径文件可都对?

likui911 commented 7 years ago

后来查了下,是g++编译的事情,vscode编译脚本没有编译ex7_26.cpp导致的 后来更新了编译脚本就可以了。