I have NetBeans 6.9 installed and working fine on Ubuntu Linux 11.10. My goal is to set compiler options like -Wall
and -std=c99
to be used by default. Currently, I have to right click on my project -> Properties -> C Compiler -> Warning Level to "More Warnings" and add -std=c99
to Additional Options. This is obviously a pain when creating many projects, and I'm sure there is a way to make all of this the default.
I found this thread which relates closely to my question. However, the only answer involves installing Code::Blocks and MSYS 1.0.11, which doesn't make much sense to me. I don't see how installing another IDE will help me, and MSYS seems unnecessary, as I am already using Linux.
I have tried every reasonable search term I can imagine, and am very surprised how little info I have turned up. It seems like most everyone who uses NetBeans should have to change this type of thing at some point. Terms I'm searching for: 'NetBeans -std=c99 default', 'NetBeans set default compile options', 'how to make NetBeans use c99 by default' and 'Code::Blocks settings into NetBeans'.
Please, someone point me in the right direction, or tell me what I should be searching for. I imagine that others have this same question, so I hope this thread is helpful.
Here are some different things that you can do:
- Copy and share the configuration files between projects, so you won't have to set every setting.
- Create a default project, and configure however you like it. When you want to create a new project, just copy the default project and rename it to something else.
- Modify your toolchain properties.
For details, see here:
You can create a Project Template Module. I was aware this is possible but didn't try it before, and this link is explaining how to do it;
https://blogs.oracle.com/seapegasus/entry/tip_create_your_own_project
(First you need NetBeans with platform SDK, not just C/C++ Bundle.)
I followed steps;
- Open/Create your project with settings you want to use.
- Create a NetBeans module project, choose a Code Base Name, i gave my.templates.ctemplate1
- Add "Module Development > Project Template" to the module project. Choose your C project in "Select Project" step.
- At next step select the Category as C/C++ and give a name for template i used MyCTemplate1.
- Right click on module project and select "Create NBM", it will create my-templates-ctemplate1.nbm in the build folder of the module project.
- Tools > Plugins > Downloaded , click "Add Plugin" and point to the nbm file in the build folder. Select install, it will give warnings because it's not signed.
- When you want to create a new C/C++ project you will see your template in the wizard which will have all the settings as your first C project has.
Enjoy other possibilities; files, folders in original project will be there.
Have you tried editing your netbeans.conf
file (for me, it's in /usr/local/netbeans-7.0.1/etc/netbeans.conf
) and adding the options you need to the netbeans_default_options
line? From looking at my version of the file, you might need to prepend -J
to the switches (hence -Wall
would become -J-Wall
.)
来源:https://stackoverflow.com/questions/7882981/setting-default-netbeans-options-std-c99-wall-for-c-programs