C++ and C Source Files in the Same Environment
To test a combination of .c and .cpp files in the same environment, choose the C++ version of the compiler template that is applicable to your compiler in the Tools | Options dialog, C/C++ tab. Selecting a C++ template will populate the Preprocessor/Compiler sub-tab with the correct options for compiling .cpp files, and will populate the Mixed C/C++ sub-tab with the correct options for compiling .c files.
Normally, you will not need to make changes to these commands. If you do make changes to the compile command, however, you should make the same changes to the command on the Mixed C/C++ tab.