Author Topic: Building/Running files without a project  (Read 4387 times)

Offline rjmarshall17

  • Single posting newcomer
  • *
  • Posts: 4
Building/Running files without a project
« on: March 30, 2012, 06:33:11 pm »
Hi,

I'm new to C::B and I'm a little confused...not an unusual state for me  :)

When I first installed C::B I opened up a bunch of .cpp files that I had written as part of a C++ Tutorial (I'm relatively new to C++). I was able to build and run them just fine. But today I added some projects (prior to this I just had the files) and now I am no longer given the option to build/run the programs by themselves. I also haven't been able to figure out how to edit the properties for the files so that I can build each of them.

Part of the issue is that, because these are all part of a tutorial, they all have a main() function, so I don't want to have to created one project per file...sorry, that just seems like overkill to me. I would just like to have a bunch of files and be able to build/run them. Is this possible with C::B? And, if not, why was I able to do it before I started adding projects?

Thanks,

Rob

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Building/Running files without a project
« Reply #1 on: March 30, 2012, 06:50:42 pm »
Not in an easy way.

Three options:
1. to add all your cpp files in a project in the same target and then right click on a file->Properties->build, then check compile and link checkboxes only for the file you want to compile and link
2. to add all your cpp file in a project and every file is added to a different target
3. do not use projects, as they are meant for multi file programs
(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 rjmarshall17

  • Single posting newcomer
  • *
  • Posts: 4
Re: Building/Running files without a project
« Reply #2 on: March 30, 2012, 07:46:43 pm »
Yeah, as I'm looking at it, it seems like once you start adding projects, you're sort-of stuck with them. The build always builds the currently active project. Since I do want to use projects, because I do have several multi-file projects (libraries - that will be built outside C::B), I will probably have to opt for either creating each tutorial as a project, or trying different build targets...Seems like multiple projects is "easiest". I just need to figure out how best to convert the current files to directories with main.cpp files...shouldn't be too hard.

Thanks for the help, that was actually what I was expecting... :(,

Rob