Running a single file in NetBeans IDE ?

Hi,
I have recently started using the NetBeans IDE for writing C++ code. I configured it to use the G++ Compiler and everything is working fine but i have a problem. I want to compile and run individual files in my C++ project but i can't seem to do that in the NetBeansIDE. The option for running individual files doesn't show up and when i try to run the entire project, i get an error which says that multiple main() methods are not allowed in a single project. Is there a solution to this problem in NetBeans or should i switch to a different IDE ? Please support your answers with suitable reasons. Thanks !
Last edited on
There is a good reason for Netbeans telling you that. You can't have more than one main(). Main() acts as the door to your program. It is always the first function to run, hence the name 'main'. If you have multiple 'doors', the program won't know which one to go inside of.

The best thing to do, is make multiple projects, but if you really just want one project, you can comment out all of the files except for the one you want to run.
Topic archived. No new replies allowed.