User forums > Using Code::Blocks
Tutorial for person new to IDEs
Jan van den Borst:
--- Quote from: thomas on August 05, 2008, 07:26:39 pm ---Once upon a time, there was an issue with spaces in pathnames, not with Code::Blocks, but with one of the MinGW tools (I forgot which one).
--- End quote ---
Was it not the windows resource compiler windres.exe?
JGM:
--- Quote from: Jan van den Borst on August 05, 2008, 10:00:43 pm ---Was it not the windows resource compiler windres.exe?
--- End quote ---
Yep! that was the one :)
LowWaterMark:
Thanks. Pecan, I am halfway through the 64p CUNY Brooklyn tutorial you linked me to and it's very well written. I'm starting to get the big picture. Again, thank you.
Hey, Thomas! I followed your instructions (6 posts above) by the numbers but Step 5 never happened. The text editor didn't open. I named it "Thomas" in the wizard and the path to the project was created it in C:\Program Files\CodeBlocks\trials\Thomas\Thomas.cbp as anticipated. But the text editor is greyed out. Thomas comes up in the tree as a Project Folder with a single "Sources" Sub-folder containing only one file, the ubiquitous "Hello World" source file entitled main.c but no Thomas.c and nowhere to type.
If I go File>New>Empty File and agree to the prompt to name and save the file Thomas.c under the current project, "Thomas", I then receive the following prompt:
--- Quote ---Select the targets this file should belong to:
1. debug
2. release
--- End quote ---
And now I'm becoming confused.
I know the fault is mine. Any idea what I am doing wrong? Erasing the text of main.c in the code::blocks editor and changing its name in Windows Explorer (which I did) seem a tad crude and probably isn't what the designers intended for me to do.
Thoughts?
LowWaterMark:
. . . and while I'm at it, why does code::blocks call for this standard library on line 2:
#include <stdlib.h>
a request never issued in the other 5000 iterations of this holy grail of introductory *.c source code that I have read.
dmoore:
--- Quote from: LowWaterMark on August 06, 2008, 09:42:57 am ---Thomas comes up in the tree as a Project Folder with a single "Sources" Sub-folder containing only one file, the ubiquitous "Hello World" source file entitled main.c but no Thomas.c and nowhere to type.
--- End quote ---
you can call your sources whatever names you want - the name of the output binaries can be totally different from the names of the sources (to see this, go to project->properties->build targets). it is a convention to use main.c as the name of the main entry point of applications (i.e. that file will contain the main function). you don't have to obey that convention (and most gui apps do not because the main function is often defined in the gui library). You do have to ensure that only one source file in each build target (see below) has a main function.
--- Quote ---If I go File>New>Empty File and agree to the prompt to name and save the file Thomas.c under the current project, "Thomas", I then receive the following prompt:
--- Quote ---Select the targets this file should belong to:
1. debug
2. release
--- End quote ---
--- End quote ---
First some background on CB projects: Each project can have multiple targets, by default the codeblocks console app wizard creates a debug and release target for you but each project can have arbitrarily many targets. targets are the binaries (and supporting files) that you want to create, typically an executable or a library. The code::blocks build system lets you define what sources are used, what compiler options are set and numerous other build instructions for each target in a project. Normally the only difference between a debug and release target is the compiler options used (the former is built with debugging symbols) but there can also be source code differences (e.g. extra logging in the debug target etc).
Now, when you create a new file, you will be asked if you want to add it to a project, then you can choose which targets to add it to. for a typical debug/release setup, it makes sense to add the file to both projects.
--- Quote from: LowWaterMark on August 06, 2008, 02:20:07 pm ---. . . and while I'm at it, why does code::blocks call for this standard library on line 2:
#include <stdlib.h>
a request never issued in the other 5000 iterations of this holy grail of introductory *.c source code that I have read.
--- End quote ---
stdlib defines some basic system and memory handling routines. you don't need it to build the helloworld app, that's just how CBs helloworld template is.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version