Anyone got a decent C Compiler?

Soldato
Joined
21 Jun 2004
Posts
2,790
Location
Berkshire
Hi,

Looking for a free/open-source C compiler to have a play with. Had a look around but can only find C++ compilers etc.

Does anyone know of a decent free one?

Thanks.
 
Hi,

I use GCC aswell, in MySYS. Quite a simple little framework. I believe NetBeans has a C++ compilter framework you can download it from the netbeans website.

Cheers

David
 
Thanks for your suggestions guys but now ive got another problem! Im using a Sam's ebook to help me get to grips with basics as I know they are quite good.

Im on the first task of the ebook to produce the common "Hello World" test program, however I cant seem to be able to compile it.

The code the ebook asks me to enter is this:

Code:
class Hello
{
	public static void: Main()
	{
		System.Console.WriteLine("Hello, World!");
	}
}

And its saying unexpected end of file. Any tips would be greatly appreciated!

Chris.
 
Google seems to suggest that is C# (just copy and paste all the code in to google - first link)

To do it in C it would be something like this:
Code:
void main(void)
{
	printf("Hello, World!");
}
 
Erm thats not C, looks a bit like c# gone wrong.

C version post above.

C++
Code:
#include <iostream>

int main(int argc,char** argv)
{
            std::cout << "Hello, world"; 
}

C# version

Code:
using System;

public class HelloWorld
{
          public static void Main()
          {
                    Console.WriteLine("Hello, world");
          }
}

Helps if you use the right compiler for the right language :-)
 
Last edited:
daven1986 said:
could just have void main(), save 4 bytes :D

Just to be pedantic,

Been a while since I did any C, but the return type of main should be int. I think ANSI standard defined this.

Gcc will give you a warning with a void return type.
test.c:2: warning: return type of ‘main’ is not ‘int’

Makes sense really since return 0; is successful exit status to the OS.
 
Last edited:
Back
Top Bottom