Author Topic: Making a driver in a project  (Read 4153 times)

Offline bloodhound

  • Single posting newcomer
  • *
  • Posts: 3
Making a driver in a project
« 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Making a driver in a project
« Reply #1 on: August 16, 2012, 10:18:48 pm »
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!]

Offline bloodhound

  • Single posting newcomer
  • *
  • Posts: 3
Re: Making a driver in a project
« Reply #2 on: August 16, 2012, 10:30:33 pm »
You have to use two separate projects or have to use two targets.
How do you have two targets?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Making a driver in a project
« Reply #3 on: August 16, 2012, 10:33:47 pm »
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!]

Offline bloodhound

  • Single posting newcomer
  • *
  • Posts: 3
Re: Making a driver in a project
« Reply #4 on: August 16, 2012, 10:52:42 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Making a driver in a project
« Reply #5 on: August 16, 2012, 11:51:07 pm »
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!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Making a driver in a project
« Reply #6 on: August 17, 2012, 12:33:23 am »
Keep both files (if both contain a main() function) in different targets or differerent projects.