Author Topic: multiple file c++ project  (Read 11414 times)

Offline Robert_S

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: multiple file c++ project
« Reply #15 on: September 04, 2007, 04:59:42 pm »
Oh, I forgot... you must add goo and fofi (and possibly splash) to the link libraries for the targets that build the 4-5 executables, else you will get missing references.
You really need to do that, too :)
[/quote]

Oh dear, I seem to have overlooked that fact until now :oops:. I can't seem to select goo or fofi targets respectively for some reason?   How do you change the target build target to goo or fofi?  I can only select Debug or Release in my project. I can see the goo and fofi targets you speak of when opening your project file.

This is proving to be a lot more diffucult than I anticipated.
« Last Edit: September 04, 2007, 05:33:06 pm by Robert_S »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: multiple file c++ project
« Reply #16 on: September 04, 2007, 05:43:14 pm »
Well, you can obviously only select targets that actually exist in a project. Thus, if you use your own project, you need to create those two targets. In the one that I posted, those targets exist already.

Go to "project options", and under the build targets tab, add three new targets (on the left side). You can choose whatever name you want. I recommend using the respective component's name for clarity, but it can really be anything.

For each of them, select "static library" on the right, and give it a meaningful output file name (the standard is libxxxxxxx.a, so you would for example want to use lib/libgoo.a. Although it does not really matter what names you choose, following the standard is good. It allows you to add the lib directory to linker options later and just use goo. The linker will then figure out that it has to be lib/libgoo.a, which is a good thing -- otherwise you would have to provide a full pathname). Also, by adhering to the standard, you are compatible with the rest of the world, so your projects will work with everybody else's.

Then, for each target, check the sources that have to go into that library (on the bottom of the dialog). If unsure, look in the build batch file. You can add headers, but you don't need to (adding headers will allow you to open them in the IDE if you want to edit them, but for the build, it does not matter).
Close "project options".

Finally, under "build options", in the linker tab, add the libraries that will be generated by above targets to "link libraries". If you have done everything "the standard way", you can just use the short names and add lib to linker search dirs. Otherwise, click on the "..." and find them with the file selector.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Robert_S

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: multiple file c++ project
« Reply #17 on: September 04, 2007, 09:00:22 pm »
I'm pleased to report that I got it to compile and run and very grateful to you for taking the time to give detailed answers my questions.
I can now endeavour to learn how the software works and hopefully modify it to my needs.

Thanks again,
                   Robert.
« Last Edit: September 04, 2007, 09:02:13 pm by Robert_S »