简体   繁体   中英

Eclipse CDT: How to use GCC C++ compiler on C sources?

I have a C++ project in which I need to use some external C sources. I need to compile them with the same Tool as the project uses: GCC C++ compiler.

I Visual Studio there is a setting to set this for each C source: C/C++ -> Advanced -> Compile as C++ Code (/TP).

Can I do this with Eclipse CDT ?

In project options:

  1. You could add -x c++ to the compiler flags:

    在此处输入图片说明

  2. Alternatively set the tool to g++ instead of gcc

    在此处输入图片说明

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