Changing the main file in a C++ netbeans project
When I create a new C++ project in netbeans,it prompts me to choose a name for the main file of the project
this is the file that gets executed when I press "Run" in the IDE
does anybody know ho开发者_开发知识库w to change this file to another one AFTER I've already created the project?
You don't need to change the name or point to a different file.
In C++, on NetBeans or any other IDE, just place main
function on a different file (the file you want to RUN when you press RUN on the IDE) and you should be done.
When we first time build and run a c project in netbeans- if there are more than one file with main() then it prompts us to select one of those files to be run. But after that it doesn't ask us to select a main file rather it uses the same file selected earlier, every time we run the program. So how to select other main file once we have selected one file during first attempt to run. I believe this is your question.
Answer: Right click project => select Properties => select make option under Build (in categories) =>Against Build result specify your file that you want to run. You can easily browse files with main() there. See picture-
精彩评论