[cfe-dev] clang options
Benjamin Kramer
benny.kra at googlemail.com
Fri Nov 20 13:33:55 PST 2009
Am 20.11.2009 um 22:19 schrieb Mike Stump:
> On Nov 20, 2009, at 11:18 AM, John Thompson wrote:
> How to force clang to compile a file as C++?
>>
>> clang -Xclang "-x=c++" -fsyntax-only file.c
>
> What about:
>
> clang++ file.c
clang decides the language depending on the file extension, so
clang(++) -x c++ file.c or renaming the file would be the right thing.
If you're on a case insensitive file system you can also take advantage
of the fact that .C (uppercase) is interpreted as c++:
clang file.c
clang file.C
compiles the same file in C and C++ mode.
More information about the cfe-dev
mailing list