【发布时间】:2016-06-20 01:40:56
【问题描述】:
我有 3 个文件。 这些在 Visual Studio 中编译。
in2post.cpp
长.h
长.hpp,
long.h #包括 long.hpp
long.hpp 和 in2post.hpp #include in2post
我的 makefile 看起来像这样
in2post: in2post.o
g++ -std=c++11 -o in2post.o in2post
in2post.o: in2post.cpp long.hpp long.h
g++ -std=c++11 -c in2post.cpp
clean:
rm *.o in2post
我明白了
hook@linprog2:~>make
g++ -std=c++11 -c in2post.cpp
In file included from long.h:40:0,
from in2post.cpp:3:
long.hpp: In member function ârob::Long<T>& rob::Long<T>::operator=(rob::Long<T>&&)â:
Long.hpp:36:1: error: expected â;â before â}â token
}
^
makefile:5: recipe for target 'in2post.o' failed
make: *** [in2post.o] Error 1
hook@linprog2:~>nano makefile
【问题讨论】:
-
该错误消息仅表示
make已退出,因为目标inpost.o的配方失败。为了向我们展示实际出了什么问题,您需要发布失败的编译命令 (g++ -c ...) 以及随之而来的所有错误,作为make的输出。 -
参见this 示例,但将
-std=c++11添加到CXXFLAGS标志。 -
g++ -o in2post.o in2post这不会相当工作。 -
我已将 -std=c++11 添加到两个 g++ 命令中。我将把原来的帖子编辑成现在的样子