News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Making a driver in a project

Started by bloodhound, August 16, 2012, 10:17:18 PM

Previous topic - Next topic

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

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.
How do you have two targets?

oBFusCATed

Have you tried Project -> Properties -> Build targets?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

bloodhound

Quote from: oBFusCATed on August 16, 2012, 10:33:47 PM
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?

oBFusCATed

Search for symbols, linking and other similar stuff...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

Keep both files (if both contain a main() function) in different targets or differerent projects.