• Recommend a good C Compiler
    31 replies, posted
I have a really good C book and it didn't tell me how to compile(well actually it did, but it was made with Unix in mind, this was printed in 1988) So can someone recommend a good C compiler preferably without an IDE, im fine use Notepad++.
GCC is probably one of the most common C compilers. It's free and open-source (like all the GNU projects), it's very standards-compliant, and it produces well-optimized executables. GCC also supports many architectures including x86, AVR, and ARM, among others. Some alternatives are icc (the intel C compiler) which is closed-source and proprietary, but available free of charge, and produces binaries which are optimized slightly better for intel processors, and TCC (or the tiny C compiler), which is very small and very fast (50 times faster at compiling than GCC) and FOSS, but doesn't optimize your binaries nearly as well as GCC or ICC would.
so if i made a game i should use GCC and if i made a console app. i am better off using TCC.
There's also Clang, which was developed by Apple. You can find a whole list of them [url=http://en.wikipedia.org/wiki/List_of_compilers#C_compilers]here[/url]. Again, I use GCC myself and I would highly recommend it.
ok i guess ill get GCC, how long is the average compile for a helloworld type program?
A couple hours iirc
?!??!!
[QUOTE=toaster468;25004767]so if i made a game i should use GCC and if i made a console app. i am better off using TCC.[/QUOTE] You should probably just use GCC for both. TCC's niche is simplicity of implementation, which might be important if you're trying to quickly port a toolchain to some really obscure platform, but it probably shouldn't be your main compiler if you're building software for an x86 machine because it just isn't as powerful as any of the full-featured compilers. [editline]07:49PM[/editline] [QUOTE=RyanDv3;25004863]A couple hours iirc[/QUOTE] :v:
the SVN doesnt seem to work are there any file hosters?
[QUOTE=toaster468;25005069]the SVN doesnt seem to work are there any file hosters?[/QUOTE] GCC will be on sourceforge somewhere. I think gnuwin32 has some good binaries.
[QUOTE=toaster468;25004472]I have a really good C book and it didn't tell me how to compile(well actually it did, but it was made with Unix in mind, this was printed in 1988)[/QUOTE] *NIX hasn't changed really since 1988. You still can do cc hello.c -o hello Also, I used to use the MinGW version of GCC on Windows. Along with MSYS.
[QUOTE=esalaka;25005379]*NIX hasn't changed really since 1988. You still can do cc hello.c -o hello[/QUOTE] This. Run Linux. Follow ancient mystical UNIX text.
i dont really have the ability to run Linux ATM. [editline]12:36PM[/editline] how do i compile after i have installed minGW
[QUOTE=toaster468;25005715]how do i compile after i have installed minGW[/QUOTE] Load up the MinGW shell and run "gcc -o executablename sourcefilename.c"
where is the shell and what executable name? im typing cc HelloWorld.c -o hello becuase someone said it above
cc might only be symlinked in a [i]real[/i] GNU/Linux environment. I'm not sure if it works in MinGW/MSYS. The MinGW shell should be somewhere in your start menu if you used the installer.
[QUOTE=ROBO_DONUT;25006299]cc might only be symlinked in a [i]real[/i] GNU/Linux environment. I'm not sure if it works in MinGW/MSYS. The MinGW shell should be somewhere in your start menu if you used the installer.[/QUOTE] Correction - the MSYS shell should be in your start menu and possibly desktop if you installed MSYS. Otherwise you can use the windows command line, which is not a good idea. Also, Windows doesn't (easily) support symlinks, so you'll have to use gcc and not cc, regardless.
[QUOTE=ROBO_DONUT;25004650]TCC (or the tiny C compiler), which is very small and very fast (50 times faster at compiling than GCC)[/QUOTE] What are the limitations of TCC that make it so fast?
[QUOTE=Overv;25018517]What are the limitations of TCC that make it so fast?[/QUOTE] Most likely it lacks many sorts of optimizations. And GCC doesn't take that long to compile programs, anyway, so it's not like you'd really notice with small projects.
[QUOTE=esalaka;25016321] Also, Windows doesn't (easily) support symlinks, so you'll have to use gcc and not cc, regardless.[/QUOTE] Navigate to MinGW/bin directory, then execute: [code]mklink /H cc.exe gcc.exe[/code] That was hard. (Requires Vista or newer)
[QUOTE=jA_cOp;25018618]Navigate to MinGW/bin directory, then execute: [code]mklink /H cc.exe gcc.exe[/code] That was hard. (Requires Vista or newer)[/QUOTE] The linking itself isn't hard, but dealing with the links in explorer is flawed. Unless it's been fixed, for example removing a link removes the target too. [editline]06:07PM[/editline] Also, I believe you can't move links or Windows will try to move the target.
[QUOTE=esalaka;25018653]The linking itself isn't hard, but dealing with the links in explorer is flawed. Unless it's been fixed, for example removing a link removes the target too. [editline]06:07PM[/editline] Also, I believe you can't move links or Windows will try to move the target.[/QUOTE] Just tested both of those symptoms on Vista SP1, it works just fine. Never heard of those problems. edit: Tried it both in Explorer and using the command line (even the MSYS tools work, there's no magic involved).
[QUOTE=jA_cOp;25018727]Just tested both of those symptoms on Vista SP1, it works just fine. Never heard of those problems.[/QUOTE] Weird, I had them on Vista.
[QUOTE=Overv;25018517]What are the limitations of TCC that make it so fast?[/QUOTE] Performance of the code seems lower, and I remember reading about things it didn't support but this was long ago and I'm not sure where I read it. You have to keep in mind that TCC was originally an obfuscated C compiler made for the obfuscated C contest. It was never designed as a full blown compiler like GCC.
i dont have the shell on my hard drive at all. But i installed it [editline]01:17PM[/editline] wow i installed minGW but i didnt DL the shell thingy donwloading now. Rate me boxes :downs: [editline]01:29PM[/editline] ok i have mingw32 MSYS thing running but when i type [code] cc HelloWorld.c [/code] it says the command cannot be found
[QUOTE=toaster468;25024697] ok i have mingw32 MSYS thing running but when i type [code] cc HelloWorld.c [/code] it says the command cannot be found[/QUOTE] The program is named "gcc", not "cc".
oh ill try that [editline]05:12PM[/editline] no dice
[QUOTE=toaster468;25028969]oh ill try that [editline]05:12PM[/editline] no dice[/QUOTE] Try "mingw32-gcc".
[QUOTE=toaster468;25024697] wow i installed minGW but i didnt DL the shell thingy [/QUOTE] Don't blame yourself. MinGW has a really crappy install process.
[QUOTE=jA_cOp;25029563]Try "mingw32-gcc".[/QUOTE] nothing... i am not going to pursue learning C. Im going to learn C# with my friend
Sorry, you need to Log In to post a reply to this thread.