0
我有3个文件。 这些在visual studio中编译。如何构建一个makefile文件
in2post.cpp
long.h
long.hpp,
long.h的#includes 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
我得到
[email protected]:~>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
[email protected]:~>nano makefile
该错误消息仅仅意味着'make'已经退出,因为目标'inpost.o'的配方失败了。为了向我们展示实际发生了什么问题,您需要发布失败的编译命令('g ++ -c ...')以及后面的所有错误,如'make'输出。 –
请参阅[this](http://stackoverflow.com/a/14180540/841108)示例,但在“CXXFLAGS”标志中添加“-std = C++ 11”。 –
'g ++ -o in2post.o in2post' this * wont * quite * work。 –