ABD
ABD

Reputation: 209

Netbeans: How do I switch between c and c++ compiler?

I'm using NetBeans IDE 8.0.2. When I set up a project I choose the option for c/c++ application.

However, when I compile my code it appears to be running a c++ compiler

(g++ -c -g -std=c++11 -MMD -MP -MF) 

instead of a c compiler. When I go to "Project Properties" under "Build" I see I can set options for a "c compiler" "c++ compiler" and "FORTRAN Compiler".

However I don't see how I am supposed to select among these as to switch the code from compiling in c++ to compiling in c (with the settings specified on the "c compiler" tab") instead of c++.

Upvotes: 2

Views: 760

Answers (1)

Christoph
Christoph

Reputation: 169763

From what I could gather online, Netbeans selects the compiler by file type, not project.

So you need to remove your main.cpp and add a main.c instead (cf Adding New Files from the tutorial).

Upvotes: 3

Related Questions