Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: bloodhound on August 16, 2012, 10:17:18 pm
-
I want to test out a function in a separate file with it's own main(). What's the best way to do this? I added a new file to the project and can build it but how do I run it? Whenever I click the green arrow the non-testing main.cpp is run.
-
You have to use two separate projects or have to use two targets.
-
You have to use two separate projects or have to use two targets.
How do you have two targets?
-
Have you tried Project -> Properties -> Build targets?
-
Have you tried Project -> Properties -> Build targets?
Thanks that works. Out of curiosity when I tried building both files it fails because "multiple definitions of main". Why is that a problem, as long as they are in different files?
-
Search for symbols, linking and other similar stuff...
-
Keep both files (if both contain a main() function) in different targets or differerent projects.