C++编译clang错误多个输出文件
C++ compilation clang error multiple output files
我不明白为什么我不能用
编译我的程序
g++ -std=c++0x main.cpp Sale.h iProduct.h -o w7
每次我尝试使用此命令进行编译时,我都会收到 clang 错误
clang: error: cannot specify -o when generating multiple output files
该程序符合 a.out 的要求,我知道我可以重命名 a.out 文件并继续前进,但我想知道为什么我会收到此错误以及我如何应该修复它。
谢谢
why I'm getting this error and how i should fix it
may I ask why do the .h files affect it?
由于gcc
的最新版本可以编译头文件,
示例:
g++ test.h -o out
file out
out: GCC precompiled header (version 014) for C++
它(gcc
) 在这种情况下生成预编译文件 (https://en.wikipedia.org/wiki/Precompiled_header)。
所以当你同时编译.cpp
文件和头文件时,
它无法决定输出预编译头文件或 elf 可执行文件。
我不明白为什么我不能用
编译我的程序 g++ -std=c++0x main.cpp Sale.h iProduct.h -o w7
每次我尝试使用此命令进行编译时,我都会收到 clang 错误
clang: error: cannot specify -o when generating multiple output files
该程序符合 a.out 的要求,我知道我可以重命名 a.out 文件并继续前进,但我想知道为什么我会收到此错误以及我如何应该修复它。 谢谢
why I'm getting this error and how i should fix it may I ask why do the .h files affect it?
由于gcc
的最新版本可以编译头文件,
示例:
g++ test.h -o out
file out
out: GCC precompiled header (version 014) for C++
它(gcc
) 在这种情况下生成预编译文件 (https://en.wikipedia.org/wiki/Precompiled_header)。
所以当你同时编译.cpp
文件和头文件时,
它无法决定输出预编译头文件或 elf 可执行文件。