SammyMe SammyMe -4 years ago 219
C Question

Code::Blocks Can't compile application

This is my hello world code:

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Hello world!\n");
return 0;
}


When I'm trying to run application I'm getting an error:

Target uses an invalid compiler; run aborted


So I went to Settings->Compiler->Toolchain Executables, and I selected
C:\MinGW\bin
, I have also tried
C:\MinGW
and I still get the same error.

I have installed Code::Blocks with mingw from the official Code::Blocks site.

Please help, I want start learning C but I can't...

Answer Source

You either have the wrong compiler selected in your project's build options OR you don't have executables set in your compiler settings.

To select your compiler in your project:

First, go to the Project menu and select Build options:

Project menu

Then, in the Build options dialog, select the compiler you have set up as described in your question:

Build Options dialog

To change your compiler's executables:

Go to Settings and then Compiler:

Settings->Compiler

Then select Toolchain Executables:

Toolchain Executables

and fill in your executable names:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download