$ make
clang++ -o build/blist.exe src/driver.cpp src/BList.h -O0 -g -Wall -Wno-unused-parameter -Wextra -Wconversion -Wold-style-cast -std=c++14 -pedantic -Wold-style-cast
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: error: cannot specify -o when generating multiple output files我的模板实现是在BList.cpp中,但是BList.h包括BList.cpp。这就是为什么我把头作为一个对象传入的原因。我不知道如何设置clang编译!
发布于 2017-06-04 07:19:17
该错误与将BList.cpp包含在BList.h中无关(尽管这本身就是一种可疑的实践)。
问题是,您将src/BList.h传递给Clang,就好像它是源文件一样。构建指令应该是:
clang++ -o build/blist.exe src/driver.cpp -O0 -g -Wall -Wno-unused-parameter -Wextra -Wconversion -Wold-style-cast -std=c++14 -pedantic -Wold-style-cast您应该相应地更新makefile。
https://stackoverflow.com/questions/44351668
复制相似问题