User forums > Using Code::Blocks
New beginner's question about projects and small programs! Please help!
nilsh:
Hello! I am writing this, because I have a little sorting problem.
Well, I am very new to C++, and I am following some examples from a book, with mostly "Hello, World!" programs. I need to program all of these to even get to a somewhat basic level, but it's kinda hard for me, because I have this problem with Code::Blocks.
My question is: How do I get to program many small programs in the same project? They can't all be named main.cpp right? And how do I even create one? I tried "new file" but didn't get the hang of it. I would really appriciate if someone would help me sort this problem out.
Do I need to create a new project for every single program I make?
Thanks in advance
-nilsh
BCCISProf:
Each project is supposed to contain one independent program. Although a project can contain many source files, there can only be one main() per project.
More than likely as a new beginner, you are working on programs which consist of only one source file. In that case each program will be a separate project.
As you advance, you will learn how to write programs which consist of multiple source files. There will still be only one main() per project.
A introductory manual to CodeBlocks can be found here: http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf
MortenMacFly:
--- Quote from: BCCISProf on February 03, 2008, 01:28:06 am ---there can only be one main() per project.
--- End quote ---
That is not correct. A project can have 1..n targets. Each target can have one main() (if you like to call it that way). Notice that a target does not require to be an application at all. It can also be a library or just a script or even just a collection of files without any compilation. Within a workspace you can have 1..n projects. So it's: 1 workspace with 1..n projects with 1..n targets each.
It might be interesting for you to read:
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks
With regards, Morten.
JGM:
--- Quote from: BCCISProf on February 03, 2008, 01:28:06 am ---A introductory manual to CodeBlocks can be found here: http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf
--- End quote ---
wow! a 64 pages how to compile and debug codeblocks manual :)
dje:
Nice, but it seems that the source code is not available...
Looks like piracy isn't it ?
Navigation
[0] Message Index
[#] Next page
Go to full version