简体   繁体   中英

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

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!

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

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