I’m a beginner of LLVM and I’d like to include some llvm headers in my file, following is main.cc
:
#include<llvm/Config/config.h>
int main(){
return 0;
}
In order to find the include file, I use llvm-config -cxxflags
to generate cxxflags for clang++:
-IE:\llvm-project-llvmorg-13.0.1\llvm\include -IE:\llvm-project-llvmorg-13.0.1\build-final\include -std:c++14 /EHs-c- /GR-
then I put cxxflags in to clang++ to compile it, error message is following:
> clang++ -IE:\llvm-project-llvmorg-13.0.1\llvm\include -IE:\llvm-project-llvmorg-13.0.1\build-final\include -std:c++14 /EHs-c- /GR- .\main.cc
clang++: error: unknown argument: '-std:c++14'
clang++: error: no such file or directory: '/EHs-c-'
clang++: error: no such file or directory: '/GR-'
Then I try to use -XClang
to wrap the error argument, there are still some errors:
clang++ -IE:\llvm-project-llvmorg-13.0.1\llvm\include -IE:\llvm-project-llvmorg-13.0.1\build-final\include -Xclang -std:c++14 -Xclang /EHs-c- -Xclang /GR- .\main.cc
error: unknown argument: '-std:c++14
I know that I can simply use clang++ -IE:\llvm-project-llvmorg-13.0.1\llvm\include -IE:\llvm-project-llvmorg-13.0.1\build-final\include main.cc
to compile my file, but I’m wondering is there a right way to merge llvm-config
’s output into windows command line?