简体   繁体   English

如何使NetBeans将.cpp文件视为C ++源代码?

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

While programming in NetBeans, I downloaded all the right compilers. 在NetBeans中编程时,我下载了所有正确的编译器。 C worked fine for me. C对我来说很好。

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. 但是现在我开始使用C ++,我意识到在打开一个扩展名为.cpp的新源文件C ++时,NetBeans会转到C编译器,然后找不到像<iostream>这样的包含。

But when opening the file with the extension .c++ the NetBeans does go to the right directory and does recognize everything C++ related. 但是当使用扩展名.c++打开文件时,NetBeans会转到正确的目录并确实识别C ++相关的所有内容。 Is there any way to change that so that the extension .cpp will also go to the right directory? 有没有办法改变它,以便扩展.cpp也将转到正确的目录? Thank You! 谢谢!

By default, NetBeans does treat .cpp files as C++ source code. 默认情况下,NetBeans将.cpp文件视为C ++源代码。 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. 单击C / C ++类别。
  3. Click the Other tab 单击“ 其他”选项卡
  4. Verify that "cpp" is in the C++ File Extensions list. 验证“cpp”是否在C ++文件扩展名列表中。 If it is missing, add it. 如果缺少,请添加它。
  5. Verify that "cpp" is not in the C File Extensions list. 验证“cpp” 不在 “C文件扩展名”列表中。 If it is present, remove it. 如果存在,请将其删除。
  6. Click OK 单击确定
  7. Maybe restart NetBeans 也许重启NetBeans

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C ++代码使用.cpp源而不是.c编译 - C++ Code Compiles with .cpp Source but not .c 如何将代码分成多个.cpp文件 C++ - How to divide code into multiple .cpp files C++ Make和C ++文件,“包含”在cpp中 - Make and c++ files, “includes” in the cpp c ++在2个.cpp源文件之间传递动态变量 - c++ passing a dynamic variable between 2 .cpp source files 一个让C++代码分割成.h和.cpp文件对程序员透明的工具 - A tool to make the division of C++ code into .h and .cpp files transparent to the programmer C++,是否有可能/您将如何定义在.h &amp;.cpp 源文件中调用 function 的 class 构造函数 - C++, Is it possible / how would you define a class constructor that calls a function in the .h & .cpp source files C/C++ 应用程序项目 (NetBeans) 中的多个源文件 - Multiple source files in a C/C++ Application project ( NetBeans ) 在cpp.react库的C ++源代码中有奇怪的“ - > * []”表达式 - Strange “->* []” expression in C++ source code of cpp.react library C++ 源代码文本编辑器,支持.h.cpp 同步 - C++ source code text editor with .h .cpp sync support 如何使用 libtooling (clang C++ API) 将 cpp 文件的源代码转换为 IR? - How to convert a cpp file's source code to IR by using libtooling (clang C++ API)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM