Skip to main content
GameDev.net gamedev.net
🔒 Locked

Codeblocks "targets"???

Started by plywood Jun 4, 2008 at 1:46 PM 0 replies 17.4k views
Original Post
plywood
plywood
Hey all, I'm trying out CodeBlocks for the first time and encountering a bizarre compile-time error that I can't find in the HTML help file, the CodeBlocks wiki, or through google. Thought maybe one of you had run into this with CodeBlocks before... When I try to "compile" my driver.cpp file (the one with my main() function) I get a "That file isn't assigned to any target" error. When I go to "build" the project (the driver plus several classes and respective headers) I get the following message: Linking stage skipped (build target has no object files to link) But it gives me no errors, even if I purposefully throw in garbage code to *try* and get build errors. I guess the first thing is: what is the difference between "compile" and "build," because I might not be understanding it exactly, and that ignorance may be impeding my ability to fix the real problem on my own. ;-) The real problem, however, is that I can't get the thing to compile. When I downloaded CodeBlocks it came with MingGW but when I set it up with the install wizard it never gave me options to select MingGW as my compiler. I'm wondering if it can't build or link because its essentially a text editor that isn't hooked up to an associated compiler... Any ideas? If you need more info, post back! Thanks, ply
Puck
Puck
Quote:
I'm wondering if it can't build or link because its essentially a text editor that isn't hooked up to an associated compiler...


You could think of it that way, yes. Code::Blocks knows about the compiler, but because it can use a variety of compilers, you have to tell it which compiler to use and what options to pass to the compiler.

You can do this by first making sure you have the project you want to associate the file with open (or you can create an empty project via the File > New menu) and make sure it's the active project - right click on its name in the project tree and click "Activate Project." Finally in the main menu bar go to the Project > Add Files menu and select the file(s) in the dialog and click Add.

You'll get a screen asking which targets you want to associate the file with. The easiest thing to do is simply select them all and click OK. You should be able to compile your file(s) now. You can change how they're compiled in the future by going to "Project" menu and Selecting "Build Options."

For more information see the Code::Blocks manual.

Edit: One last thing. The compiler to use can be selected at project creation and later in the build options dialog. However, MinGW is the default compiler for most project templates, so you don't have to worry about that. [smile]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.