2

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.

2 Answers2

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
  • 430
  • 3
  • 9
  • 25
-2

Try the following:

sudo apt-get install build-essential 

Then try to build and compile.

Uwe Keim
  • 2,112
bill
  • 1