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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于每个项目,配置属性都保存在
\nbproject\configurations.xml
(%UserProfile%\Documents\NetBeansProjects\ProjectName\nbproject\configurations.xml
) 文件中。您可以在项目之间共享
configurations.xml
文件,这样您就不必更改和应用每个设置。您可以创建一个默认项目并根据需要进行配置。您可以复制它并将其命名为其他名称,而不是创建新项目。
如果您希望工具链属性应用于每个项目,则需要手动修改工具链定义或创建新的工具链定义。
生成工具集合描述符的卷影副本:
%ProgramFiles%\NetBeans x\etc\netbeans.conf
:%ProgramFiles%\NetBeans x\
。etc
文件夹>属性>安全>编辑...>>在“组和用户名”下,选择“用户”组 >在“用户权限”下,对于“完全控制”,启用“允许”>确定>好的。在可以处理换行符的文本编辑器中打开
%ProgramFiles%\NetBeans x\etc\netbeans.conf
。在以
netbeans_default_options
开头的行中,将-J-Dcnd.toolchain.personality.create_shadow=true
添加到值字符串。例如,该行现在可能如下所示:
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"
%Appdata%\NetBeans\ 中的
。在toolchain.properties
文件x\config\Preferences\org\netbeans\modules\cnd\toolchain.properties
中,删除行toolchain_shadow=true
并保存。netbeans_default_options
开头的行中,从值字符串中删除-J-Dcnd.toolchain.personality.create_shadow=true
。换句话说,撤消编辑即可将文件恢复到原始状态。修改或创建工具链定义:
%Appdata%\NetBeans\x\config\CND\ToolChain\
(7.2+) 或%UserProfile%\.netbeans\x\config\CND\ToolChain\
(7.1 .2-).MinGW.xml
。在
c
元素中,有一个development_mode
元素,其中包含不同的开发模式选项元素。您可以通过修改flags
属性来修改特定开发模式的标志。例如,当您添加
-std=c11 -g3 -pedantic -Wall -Wextra -O0
标志时,属性可能如下所示:<前><代码><开发模式>
/>
在
cpp
元素中,有一个development_mode
元素,其中包含不同的开发模式选项元素。您可以通过修改flags
属性来修改特定开发模式的标志。例如,当您添加
-std=c++11 -g3 -pedantic -Wall -Wextra -O0
标志时,属性可能如下所示:<前><代码><开发模式>
/>
/>
要查找不同平台上的
netbeans.conf
配置文件,请参阅:如何使自定义启动参数永久生效?
http://wiki.netbeans.org/FaqNetbeansConf
要查找不同平台上的用户目录,请参阅:
什么是cachedir以及在哪里可以找到它?
http://wiki.netbeans.org/FaqWhatIsUserdir
有关工具集合描述符的信息,请参阅:
使用 C/C++ 工具集合描述符 - NetBeans IDE 6.9 教程:
http://netbeans.org/kb/69/cnd/toolchain.html< /a>
For each project, the configuration properties are saved in the
\nbproject\configurations.xml
(%UserProfile%\Documents\NetBeansProjects\ProjectName\nbproject\configurations.xml
) file.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:
%ProgramFiles%\NetBeans x\etc\netbeans.conf
:%ProgramFiles%\NetBeans x\
.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.Open
%ProgramFiles%\NetBeans x\etc\netbeans.conf
in a text editor that can handle the newlines.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"
toolchain.properties
file in%Appdata%\NetBeans\x\config\Preferences\org\netbeans\modules\cnd\
. Intoolchain.properties
, remove the linetoolchain_shadow=true
, and save.netbeans_default_options
, remove-J-Dcnd.toolchain.personality.create_shadow=true
from the string of values. In other words, undo the edit to restore the file back to its original state.Modify or create the toolchain definition:
%Appdata%\NetBeans\x\config\CND\ToolChain\
(7.2+) or%UserProfile%\.netbeans\x\config\CND\ToolChain\
(7.1.2-).MinGW.xml
.Within the
c
element, there is adevelopment_mode
element containing the different development mode option elements. You can modify the flags for a particular development mode by modifying theflags
attribute.For example, when you add the
-std=c11 -g3 -pedantic -Wall -Wextra -O0
flags, the attributes may look like this:Within the
cpp
element, there is adevelopment_mode
element containing the different development mode option elements. You can modify the flags for a particular development mode by modifying theflags
attribute.For example, when you add the
-std=c++11 -g3 -pedantic -Wall -Wextra -O0
flags, the attributes may look like this: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:
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:
Using the C/C++ Tool Collection Descriptor - NetBeans IDE 6.9 Tutorial:
http://netbeans.org/kb/69/cnd/toolchain.html
首先从 Code::Blocks IDE Downlowd 和 MSYS 1.0.11
所有设置都会自动配置,但您必须从
First download and install Code::Blocks IDE from Code::Blocks IDE Downlowd and MSYS 1.0.11
All setting will automatically configured, but you have to select "make" command from
在带有 MinGW (gcc) 的 Windows 7 Professional 下使用 netBeans 8.1,我找到了文件
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\Preferences\org\netbeans\modules\cnd*toolchain.properties *,
但我找不到文件夹
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\CND
(所以我找不到 C:\Users\Username\AppData\Roaming\ NetBeans\8.1\config\CND\ToolChain)
我找到了文件夹
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\Preferences\org\netbeans\modules\cnd
但没有 MinGW .xml 文件在那里。我在安装 NetBeans(和 MinGW)的硬盘驱动器上找不到这个 MinGW.xml 文件。
Using netBeans 8.1 under Windows 7 Professional with MinGW (gcc), I found the file
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\Preferences\org\netbeans\modules\cnd*toolchain.properties*,
but I can't find the folder
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\CND
(so I can't find C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\CND\ToolChain)
I found the folder
C:\Users\Username\AppData\Roaming\NetBeans\8.1\config\Preferences\org\netbeans\modules\cnd
but there's no MinGW.xml file there. I find this MinGW.xml file nowhere on the hard disk drive where NetBeans (and MinGW) are installed.