How to get NetBeans to process .cpp files as C ++ source code?

When programming in NetBeans, I loaded all the correct compilers. C worked fine for me.

But now that I’ve started working with C ++, I realized that when I open a new C ++ source file with the .cpp extension, NetBeans goes to C compilers and then cannot find include, for example, <iostream> , etc.

But when you open a file with a .c++ extension, NetBeans really goes to the right directory and recognizes everything related to C ++. Is there a way to change this so that the .cpp extension also goes to the correct directory? Thanks!

+6
source share
1 answer

By default, NetBeans treats .cpp files as C ++ source code. Mappings with the file extension are customizable, so it’s possible that they are different or damaged on your computer. To change them, follow these steps:

  • Choose Tools-> Options
  • Select the C / C ++ category.
  • Go to the Others tab
  • Make sure "cpp" is in the list of C ++ file extensions. If it is missing, add it.
  • Make sure "cpp" is not in the "C file extensions" list. If it is present, delete it.
  • Click OK
  • Maybe restart NetBeans
+4
source

Source: https://habr.com/ru/post/979972/


All Articles