Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: primetime on April 25, 2006, 02:35:51 am

Title: Compile and Run Doesn't Work
Post by: primetime on April 25, 2006, 02:35:51 am
Hey all.

I just downloaded Code::Blocks because I'm searching for a good IDE whilst I'm learning C++. However the button for "Compile and Run" can't work or isn't clickable.  Is there any way to have it working for non-project type files?

Thanks.
Title: Re: Compile and Run Doesn't Work
Post by: Conan Kudo on April 25, 2006, 02:49:07 am
I don't think so... The devs said they wouldn't support it..
Title: Re: Compile and Run Doesn't Work
Post by: thomas on April 25, 2006, 02:50:11 am
From your description, you are using RC2.

Extensive support for compiling (and compile-and-run) single source files without a project was only added after RC2. You may want to risk a look at a nightly build, the nightly builds are at least as stable as RC2 (actually more stable...).

Please do note that a couple of things may not work properly without a project (for example the class browser or code completion). That is deliberate and not a bad thing, since for everything more complicated than "Hello World", you will need a project anyway (for organisation).
Title: Re: Compile and Run Doesn't Work
Post by: thomas on April 25, 2006, 02:52:49 am
I don't think so... The devs said they wouldn't support it..
That's not right. First, nobody said that, and second, it does work nicely in current HEAD (I just tried before writing the above, to be 100% sure).
Title: Re: Compile and Run Doesn't Work
Post by: Conan Kudo on April 25, 2006, 03:01:32 am
I don't think so... The devs said they wouldn't support it..
That's not right. First, nobody said that, and second, it does work nicely in current HEAD (I just tried before writing the above, to be 100% sure).

I think it was said in: http://forums.codeblocks.org/index.php?topic=437.0
Title: Re: Compile and Run Doesn't Work
Post by: primetime on April 25, 2006, 03:24:47 am
Thanks for the reply.

I didn't realize that Code::Blocks was targeted more for the advanced coder with big projects.  I just saw an IDE with a simple interface that I'd like to use to learn C++ on.

Edit:
I just tried the April 23 build.  Build and Run works now :D  Hooray for "Hello World!"
Title: Re: Compile and Run Doesn't Work
Post by: thomas on April 25, 2006, 09:17:20 am
I think it was said in: http://forums.codeblocks.org/index.php?topic=437.0
Well, that was in June 2005, even before RC1 was released. The devs were not sure whether or not that feature was needed, and made a poll. The poll turned out positive, and subsequently, it was added.

There has been a bit of confusion since then, since some users think it does not matter whether you have a project, so single files have the exact same functionality as project files. When it turns out that this is not the case, they are quite surprised. A couple of features are a lot harder to implement (or don't make sense at all) if you have no project. Therefore, some things don't work the same way without a project.
But that does not mean that compiling and running single files shall generally not be supported. If a user just wants to test whether a give snippet of code works at all, that's fine.

Quote
I didn't realize that Code::Blocks was targeted more for the advanced coder with big projects.  I just saw an IDE with a simple interface that I'd like to use to learn C++ on.
The good thing is you can do both :)
But seriously: once you have more than a few dozen lines of code, or more than 3-4 classes, you will see that you actually want to split your sources into separate files and you are actually happy to have something like a project to organise your stuff. Pain increases exponentially with file size ;)