GCC 的 NetBeans 设置 [英] NetBeans settings for GCC

查看:18
本文介绍了GCC 的 NetBeans 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击项目属性时,我可以设置警告级别(更多警告)和命令行 ->附加选项 (-std=c99).但是我希望我的所有 C 项目默认都有那种选项,而无需每次创建新项目时手动设置它们.

When I click on project properties I can set Warning level (More Warnings) and Command Line -> Additional Options (-std=c99). But I want that all my C project have that kind of options by default without manually setting them everytime I create new project.

推荐答案

对于每个项目,配置属性都保存在 bprojectconfigurations.xml (%UserProfile%DocumentsNetBeansProjectsProjectName bprojectconfigurations.xml) 文件.

For each project, the configuration properties are saved in the bprojectconfigurations.xml (%UserProfile%DocumentsNetBeansProjectsProjectName bprojectconfigurations.xml) file.

您可以在项目之间共享 configurations.xml 文件,这样您就不必更改和应用每个设置.

You could share the configurations.xml file between projects so that you won't have to change and apply every setting.

您可以创建一个默认项目并根据需要对其进行配置.您可以复制它,并将其命名为其他名称,而不是创建一个新项目.

You could create a default project and configure it however you like. Instead of creating a new project, you could copy it, and name it something else.

如果您希望将工具链属性应用于每个项目,则需要手动修改工具链定义或创建一个新的工具链定义.

If you want the toolchain properties to apply to every project, you will need to manually modify your toolchain definition or create a new one.

  • 生成工具集合描述符的影子副本:

  • Generate shadow copies of the tool collection descriptors:

  • NetBeans > 文件 > 退出.
  • 获得修改 %ProgramFiles%NetBeans xetc etbeans.conf 的写入权限:
    • 开始 > 运行 > %ProgramFiles%NetBeans x.
    • 右键单击 etc 文件夹 > 属性 > 安全 > 编辑... > 在组和用户名"下,选择用户"组 > 在用户权限"下,对于完全控制",启用允许">确定">确定".
    • NetBeans > File > Exit.
    • Gain write access to modify %ProgramFiles%NetBeans xetc etbeans.conf:
      • Start > Run > %ProgramFiles%NetBeans x.
      • Right click on the etc folder > Properties > Security > Edit... > Under "Group and user names", select the "Users" group > Under "Permissions for Users", for "Full control", enable "Allow" > OK > OK.

      在可以处理换行符的文本编辑器中打开 %ProgramFiles%NetBeans xetc etbeans.conf.

      Open %ProgramFiles%NetBeans xetc etbeans.conf in a text editor that can handle the newlines.

      • 在以 netbeans_default_options 开头的行上,将 -J-Dcnd.toolchain.personality.create_shadow=true 添加到值字符串中.

      • On the line starting with netbeans_default_options, add -J-Dcnd.toolchain.personality.create_shadow=true to the string of values.

      • 例如,该行现在可能如下所示:

      • For example, the line may now look like:

      netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dcnd.toolchain.personality.create_shadow=true"

      • 如果在升级和导入 NetBeans 配置文件后不执行此步骤,NetBeans 可能不会生成卷影副本.此外,您可能无法使用任何构建工具,并且在您尝试配置 C/C++ 构建工具时可能会收到在目录中找不到编译器集..."错误.

      修改或创建工具链定义:

      Modify or create the toolchain definition:

      • 开始 > 运行 > %Appdata%NetBeansxconfigCNDToolChain (7.2+) 或 %UserProfile%.netbeansxconfigCNDToolChain (7.1.2-).
      • 为您的工具链找到相应的 XML 文件.
        • 例如,MinGW 工具链定义文件是 MinGW.xml.
        • Start > Run > %Appdata%NetBeansxconfigCNDToolChain (7.2+) or %UserProfile%.netbeansxconfigCNDToolChain (7.1.2-).
        • Locate the corresponding XML file for your toolchain.
          • For example, the MinGW toolchain definition file is MinGW.xml.

          c 元素中,有一个 development_mode 元素,其中包含不同的开发模式选项元素.您可以通过修改 flags 属性来修改特定开发模式的标志.

          Within the c element, there is a development_mode element containing the different development mode option elements. You can modify the flags for a particular development mode by modifying the flags attribute.

          • 例如,当您添加 -std=c11 -g3 -pedantic -Wall -Wextra -O0 标志时,属性可能如下所示:

          • For example, when you add the -std=c11 -g3 -pedantic -Wall -Wextra -O0 flags, the attributes may look like this:

          <development_mode>
              <fast_build flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0"/>
              <debug default="true" flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -g"/>
              <performance_debug flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -g -O"/>
              <test_coverage flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -g"/>
              <diagnosable_release flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -g -O2"/>
              <release flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -O2"/>
              <performance_release flags="-std=c11 -g3 -pedantic -Wall -Wextra -O0 -O3"/>
          </development_mode>
          

        • cpp 元素中,有一个 development_mode 元素,其中包含不同的开发模式选项元素.您可以通过修改 flags 属性来修改特定开发模式的标志.

          Within the cpp element, there is a development_mode element containing the different development mode option elements. You can modify the flags for a particular development mode by modifying the flags attribute.

          • 例如,当您添加 -std=c++11 -g3 -pedantic -Wall -Wextra -O0 标志时,属性可能如下所示:

          • For example, when you add the -std=c++11 -g3 -pedantic -Wall -Wextra -O0 flags, the attributes may look like this:

          <development_mode>
              <fast_build flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0"/>
              <debug default="true" flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -g"/>
              <performance_debug flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -g -O"/>
              <test_coverage flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -g"/>
              <diagnosable_release flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -g -O2"/>
              <release flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -O2"/>
              <performance_release flags="-std=c++11 -g3 -pedantic -Wall -Wextra -O0 -O3"/>
          </development_mode>
          

          要在不同平台上查找netbeans.conf 配置文件,请参阅:

          For finding the netbeans.conf configuration file on different platforms, see:

          • 如何使我的自定义启动参数永久有效?

          • How do I make my custom startup parameters permanent?

          http://wiki.netbeans.org/FaqNetbeansConf

          要在不同平台上查找用户目录,请参阅:

          For finding the user directories on different platforms, see:

          • 什么是userdir,我在哪里可以找到它?什么是 cachedir,我在哪里可以找到它?

          • What is a userdir and where can I find it? What is a cachedir and where can I find it?

          http://wiki.netbeans.org/FaqWhatIsUserdir

          有关工具集合描述符的信息,请参阅:

          For information on tool collection descriptors, see:

          • 使用 C/C++ 工具集合描述符 - NetBeans IDE 6.9 教程:

          • Using the C/C++ Tool Collection Descriptor - NetBeans IDE 6.9 Tutorial:

          http://netbeans.org/kb/69/cnd/toolchain.html

          这篇关于GCC 的 NetBeans 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆