Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Make NetBeans Treat .cpp Files as C++ Source Code?

Tags:

c++

netbeans

While programming in NetBeans, I downloaded all the right compilers. C worked fine for me.

But now that I started working with C++, I realized that while opening a new source file C++ with the extension .cpp the NetBeans goes to the C compilers, and then can't find include such as <iostream> etc.

But when opening the file with the extension .c++ the NetBeans does go to the right directory and does recognize everything C++ related. Is there any way to change that so that the extension .cpp will also go to the right directory? Thank You!

like image 560
Mumfordwiz Avatar asked Dec 20 '14 13:12

Mumfordwiz


1 Answers

By default, NetBeans does treat .cpp files as C++ source code. The file extension mappings are configurable, so it is possible that they are different or corrupt on your machine. To change them do the following:

  1. Select Tools->Options
  2. Click the C/C++ category.
  3. Click the Other tab
  4. Verify that "cpp" is in the C++ File Extensions list. If it is missing, add it.
  5. Verify that "cpp" is not in the C File Extensions list. If it is present, remove it.
  6. Click OK
  7. Maybe restart NetBeans
like image 65
Corey Avatar answered Oct 13 '22 00:10

Corey