User forums > Using Code::Blocks
Making a driver in a project
bloodhound:
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.
oBFusCATed:
You have to use two separate projects or have to use two targets.
bloodhound:
--- Quote from: oBFusCATed on August 16, 2012, 10:18:48 pm ---You have to use two separate projects or have to use two targets.
--- End quote ---
How do you have two targets?
oBFusCATed:
Have you tried Project -> Properties -> Build targets?
bloodhound:
--- Quote from: oBFusCATed on August 16, 2012, 10:33:47 pm ---Have you tried Project -> Properties -> Build targets?
--- End quote ---
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?
Navigation
[0] Message Index
[#] Next page
Go to full version