Code::Blocks can't build / Compiler error?

2

1

My problem is that when I try to run anything on Code::Blocks it says: "It seems that your program hasn't been built yet". After I try to build it this pops up again. I have seen a similar question somewhere, but I still couldn't resolve my problem (by re-installing GCC (GNU compiler collection) ).

Note: I am using Ubuntu with no internet access, so I installed Code::Blocks and re-installed GCC using APTonCD. Also I am trying to learn C++, not C, if that helps. Oh and it dosen't look like an error message, just like an info thingy.

user288874

Posted 2014-02-19T18:16:30.823

Reputation:

1The Q is on-topic both here and on [ubuntu.se] and on [unix.se], it would also be on topic on [so] since it is about using a programming tool, it's up to you where you want it to be (just don't post it on more than one site). Anyway, you have two "or something"s in your question, please tell us exactly what the error message says so we can search for it. Ideally, you should also include a minimal reproducible example so we can try it. – terdon – 2014-02-19T18:46:51.053

Answers

2

There could be several reasons behind the issue you are having. Since you haven't included much information on it I will have to guess on what's most likely your case, considering the most common ones among beginners. Terdon gave good suggestions on improving the question. So the possible reasons :

1. You installed Code::Blocks version without the compiler.

Here are the current Code::Blocks binaries that you can download for your system. Actually I use C::B on Windows and installing a copy there needs some care to choose the one with preinstalled MinGW compiler, if that is the one the user intends to use. If your C::B installation includes a compiler or, as understood from your question, you have installed a compiler separately - skip to next steps.

2. Your compiler setup in Code::Blocks is incorrect

I will assume you have set the system path for GCC correctly after installing it. Take a look at the settings in C::B - Go to Settings-> Compiler-> Toolchain executables.

First of all, at the top of the window, you must have GNU GCC COMPILER as the selected compiler. Then lower in the window there are many fields, looking something like this :

enter image description here

Of course your settings should be different than mine, but it is important that #1 they are there and #2 they are correct, so check it.

3. You haven't created a project

Although it is possible in C::B to open a new blank file, write code in it and try build+run it, it is not a really good idea, and particularly not if you are just starting out. So if you want to start coding and then testing the application out, create a new project. You find it in File-> New-> Project and there I suppose best option for you to choose is Console application. Steps that follow are quite straightforward and questions are clear with some descriptions, so I don't expect you to have any problems there.

James C

Posted 2014-02-19T18:16:30.823

Reputation: 390

My error was that I had created a Empty project. I created a new Console application, moved my source files there and it worked just fine. Guess there are some settings left out in the Empty project. – Krøllebølle – 2015-04-14T09:04:12.357

-2

Try the following:

sudo apt-get install build-essential 

Then try to build and compile.

bill

Posted 2014-02-19T18:16:30.823

Reputation: 1