Author Topic: Basic help needed with Build  (Read 6033 times)

Rainboy56

  • Guest
Basic help needed with Build
« on: December 05, 2011, 12:02:22 am »
I am a new user of code blocks and tried to run the simple "hello world" project. I get the following error message every time I try to build. Any help would be greatly appreciated. I am doing this in C on windows. Thanks.

-------------- Build: Debug in hello world ---------------

Compiling: main.c
Execution of 'gcc.exe -Wall  -g     -c "C:/cygwin/cygdrive/Hello World/main.c" -o obj/Debug/main.o' in 'C:\cygwin\cygdrive\Hello World' failed.
Nothing to be done.


Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Basic help needed with Build
« Reply #1 on: December 05, 2011, 12:12:26 am »
I am a new user of code blocks and tried to run the simple "hello world" project. I get the following error message every time I try to build. Any help would be greatly appreciated. I am doing this in C on windows. Thanks.

-------------- Build: Debug in hello world ---------------

Compiling: main.c
Execution of 'gcc.exe -Wall  -g     -c "C:/cygwin/cygdrive/Hello World/main.c" -o obj/Debug/main.o' in 'C:\cygwin\cygdrive\Hello World' failed.
Nothing to be done.



From what I have experienced, Cygwin has issues with spaces. But that was my past experience with it.

Can you post your hello world code ? Because you might actually have something simple in the code that is preventing it from compiling. Also, I use the GNU GCC option ( it uses the MingW Compiler ) which compiles both C++ and C depending on how you set it up on C::B. Just letting you know that in case you didn't know. MingW comes with one of the options for the C::B download. So you have a choice to get the downloaded package with or without the MingW compiler.

Also what Windows version are you on ?
« Last Edit: December 05, 2011, 12:15:20 am by JackDawson »

Rainboy56

  • Guest
Re: Basic help needed with Build
« Reply #2 on: December 05, 2011, 12:30:20 am »
I am on Windows XP. Here is the code.
========================

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

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

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Basic help needed with Build
« Reply #3 on: December 05, 2011, 12:49:21 am »
I am on Windows XP. Here is the code.
========================

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

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


Ok that code is correct and in fact is the GNU GCC default C code for MingW too. This is the default that comes with Code::Blocks to begin with. So your code is obviously correct because it compiles just fine. However Cygwin, even from my past experience, just plain never worked right. Its why I moved over to MingW.

However, if your just NEEDING to stick with Cygwin, you might have to actually look at the Cygwin website to see if it has dependencies that you potentially could be missing for your Cygwin install.

The list of KNOWN compilers taken from the official Wiki for Code::Blocks is :

Supported compilers

    GNU GCC (incl. G77) (Linux)
    MinGW GCC (incl. G77) (Win32)
    MSP430 GCC (Win32)
    TriCore GCC (Win32, Linux)
    PowerPC GCC (Win32, Linux)
    Apple GCC (Xcode) (Mac OS X)
    Microsoft Visual C++ Toolkit 2003 (Win32)
    Microsoft Visual C++ 2005 (Win32)
    Borland's C++ Compiler 5.5 (Win32)
    DigitalMars C/C++ (Win32)
    OpenWatcom (Win32)
    Intel C++ compiler (Win32)
    Small Device C Compiler (SDCC)
    Digital Mars D
    GDC D Compiler
    LLVM D Compiler

Rainboy56

  • Guest
Re: Basic help needed with Build
« Reply #4 on: December 05, 2011, 01:09:31 am »
Thanks for your help. I took your advice and downloaded a new copy with Mingw. I reran the program and now got a different error message using the GNU gcc option.

============
"hello world - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.
============

So I checked the settings in global compiler settings and hit auto detect but still get the same error. This is what my compiler settings show. I used default settings for the installation.

Compilers installation directory: C:\Cygwin
C Compiler: gcc.exe

Do I need to change this?

Here is the screen shot if this helps.

zabzonk

  • Guest
Re: Basic help needed with Build
« Reply #5 on: December 05, 2011, 01:24:18 am »
Yes you need to change it. Go to Settings|Compiler and Debugger|Toolchain Executables, and use the ... button to locate the installation root directory for MinGW GCC. You may also need to change the program files in the same dialog. And I personally would not use MinGW GCC directly, but instead that supplied by TDM at http://tdm-gcc.tdragon.net/

Rainboy56

  • Guest
Re: Basic help needed with Build
« Reply #6 on: December 05, 2011, 01:37:22 am »
Thank you!

Do I need to change the C compiler from "gcc.exe" to another executable file? I dont know what the MinGW GCC executable file is called.

I am also downloading the tdm version.

Rainboy56

  • Guest
Re: Basic help needed with Build
« Reply #7 on: December 05, 2011, 01:52:57 am »
It works...thanks for all of the advice.

I had been searching through the archives and couldnt find the answer. I appreciate you helping a newbie!


Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Basic help needed with Build
« Reply #8 on: December 05, 2011, 06:46:35 am »
It works...thanks for all of the advice.

I had been searching through the archives and couldnt find the answer. I appreciate you helping a newbie!



Glad we could help. I was going to say, there was nothing I have ever needed to adjust. It gives you a choice if you choose the GNU GCC and its automatically using MinGW. It would show you a choice of C / C++ depending on how you open a new blank project.

But hey, if you got it to work, good job. :)