News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compiling and linking three files

Started by buffbill, March 19, 2013, 04:37:02 AM

Previous topic - Next topic

buffbill

I'm following a number of books learning C++ using C::B v 10.05 with OS MS/XP.
My C++ Prima now requires that three files are employed rather than just a single *.cpp file.
One file is a " header" containing the class information starting with #ifndef and ending with #endif.
The other two files are .cpp files one for class methods and one for main() and its headers.
My problem is to determine how to compile and link the 3 files. My other apparently unrelated problem is that the debugging comand icons are always grayed out when i am using C::B.
Any help would be appreciated.

Radek

That's why you have an IDE like Code Blocks ;) It allows you to create projects consisting from more than one source file. Therefore:

(1) Create a new project.
(2) Add both source files to the project. You can also add the header (recommended, the header will be at hand when you work on the project).
(3) In the Build Options - Compiler, tell the compiler where is your header.
(4) In the Build Options - Linker, inform the linker on additional libraries (if any).
(5) Save the project.
(6) Compile.
(7) Run or Debug.

buffbill

Thanks Radek ... will let you know how I go.

buffbill

I don't seem to be able to name a project by clicking on "Create a new Project" on the opening page of C::B. The drop down box has no templates so I can't select one.
The Project/Build Options is grayed out. Any suggestion?

oBFusCATed

Reinstall and make sure you enable the contrib plugins and it particular the scripted wizard plugin.
(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!]

buffbill

Thanks oBFusCATed ... think I'm sorted now.