简体   繁体   中英

clang++ default parameters or configuration file

I would like to develop in C++ 14 and to make that standard a default for my compilers (mainly g++ and clang++).

This has the advantage of avoid messing up with the internal configurations of the Eclipse CDT, for parsing, compiling etc.

For the gcc compiler, I manage to provide a "specs" file and, finally, now C++14 code compiles as simple as:

$g++ testcpp14.cpp

However, I did not find a similar thing for clang(++). It is just like providing some command line parameters by default for the compiler, or a configuration.

Is there any configuration file for clang/clang++? Or for the C++ language that the compiler uses (as clang++ is just a driver).

Thank you very much.

edit: I try to avoid shells, that is providing scripts that later delegate the compilation towards the trye compiler. Reason?: well, you have to provide a lot of scripts (g++, gcc, clang, clang++ etc.) and it still does not prevent an IDE to call /usr/bin/g++ directly, bypassing the PATH-provided script. Only if you replace the binary /usr/bin/g++ (or clang++) you may achieve something, but this is unmaintainable when you upgrade the .deb gcc package.

As of Clang 6, it supports configuration files . Command-line options provided in the file are prepended to the rest of the options on the command line. The file name can be provided on the command line, or can be encoded in the name of the command used to invoke the compiler.

The example use case in the question is unnecessary, though, because another change introduced in Clang 6 was to make the default C++ dialect be C++14 (more precisely, gnu++14).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM