Thread: Best C compiler (free)

  1. #1
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794

    Best C compiler (free)

    I currently use the gcc compiler which I am very happy with. But are there any other ones to consider? I understand that gcc is a 16 bit compiler and as my machine is 64-bit capable am I maybe losing out performance wise?

    Also I might like to use some 'windows' to display results etc (basically give it a graphical interface). Can I do this with GCC? or am I looking at something else, like C++ for that?

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I understand that gcc is a 16 bit compiler and as my machine is 64-bit capable am I maybe losing out performance wise?
    No, GCC is a 32 bit compiler. And you can get 64 bit versions, at least for Linux. Anyway, the difference in performance is probably very little, and you lose some portability.

    Also I might like to use some 'windows' to display results etc (basically give it a graphical interface). Can I do this with GCC? or am I looking at something else, like C++ for that?
    Many ports of GCC include Windows GUI support for C and C++. You can create Windows GUIs with Dev-C++: http://bloodshed.net/devcpp.html

    You could also get Visual C++ Express Edition. I understand that it can create some GUIs. I really like GCC myself though.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    The Windows build of GCC comes with Windows' headers, libraries and such you shouldn't need to use another compiler (you could use a 3rd party resource creator to make the dialogs, then compile with GCC OR hand code the dialog).

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    http://www.cprogramming.com/compilers.html

    gcc is usually for 32-bit systems. 16-bit would be like an Intel 286.

    As for losing out, I wouldn't worry about it until you know how to make code that can run faster on a 64-bit machine.

    gcc probably has a port of 64-bit gcc somewhere, but I'm not sure. I've never looked into it since I don't have a 64-bit machine. edit: see dwks's post

    You can do a graphical interface with gcc. I guess you're using microsoft windows? to use the win32 interface, you'll need a windows compiler like mingw32 or cygwin, and then learn the win32 api.

    And I don't know of a port of gcc that doesn't have a C++ compiler also. Try typing 'g++ -v' or 'gpp -v'
    Last edited by robwhit; 06-11-2007 at 05:31 PM.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by esbo View Post
    I understand that gcc is a 16 bit compiler and as my machine is 64-bit capable am I maybe losing out performance wise?
    Where did you get this understanding? GCC is not a 16 bit, or 32 bit, or 64 bit compiler. It is a compiler, period, which is targetted at many (dozens if not hundreds) of platforms of various types.

    Also I might like to use some 'windows' to display results etc (basically give it a graphical interface). Can I do this with GCC? or am I looking at something else, like C++ for that?
    Whether your program uses a GUI or not really has nothing to do with the compiler or even language you use. Provided you can link with the proper libraries, you can do anything you want.

  6. #6
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    It's just I noticed ntbdm was running and I assume my program launches it.
    Could also be to do with the msdos batch file though.

    "ntvdm.exe is process that belongs to the Windows 16-bit Virtual Machine. It provides an environment for a 16-bit process to execute on a 32-bit platform. This program is important for the stable and secure running of your computer and should not be terminated."

    Anyway you are probably right about the performance as most of the time is taken in thrashing the disk. It has about 200,000 files to process and it takes about 40 minutes. However if I do a re-run of the same files when they have been buffered in memory it takes a fraction of the time. (Which I why I wanted to be able to save the database and reload it again so I could just process the latest files (as opposed to 9 months worth!)

    I think I tried bloodshed before but found it a bit 'too much' I like the simplicity of gcc however I guess if you want windows you have to put up with all the 'crap' which comes with it
    So I will have a look at the options.

  7. #7
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Im not sure of which version I have of GCC. I best have a look!!


    Version 2.03
    DJGPP is a non-proprietary environment for developing 32-bit protected
    mode software in C/C++ under MS-DOS.

    So maybe I can use this. However I think it will involve a big learning curve!

  8. #8
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Is that the 'windows builid'?

  9. #9
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by esbo View Post
    Version 2.03
    DJGPP is a non-proprietary environment for developing 32-bit protected
    mode software in C/C++ under MS-DOS.
    This is definitely not what you want. DJGPP is designed to run 32 bit apps under DOS (as it says right there) using protected mode extensions. This has been obsolete since... I dunno, 1996 or so?

    Just get cygwin and forget about it.

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    For Windows, MinGW ftw! Uh, yeah, basically GCC.

    Do not use a DOS compiler for Windows. That's kind of silly.

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    DJGPP is for DOS. If you want to write windows programs, get a windows compiler, like mingw32 or cygwin or Visual whatever or Borland or Watcom. I suggest mingw32.

    The reason it says 32-bit when DOS is 16-bit is because it changes the mode of the processor to a 32-bit protected mode with the help of DPMI software. But you can't make windows programs with it unless you get RSXNT or whatever it's called, which I haven't gotten to work.

    Just get cygwin or mingw32, they're both gcc ports.

  12. #12
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    As the others mentioned, go for mingw, and for a GUI IDE, I find code::blocks (C/C++) is a really nice IDE (and has nightly builds/releases).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "if you love someone" :D
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-02-2003, 01:10 AM
  2. Compiler Design... Anyone That Can Help!
    By ComputerNerd888 in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2003, 09:48 AM
  3. EzWindows and Borland 5.5 free compiler
    By savageag in forum C++ Programming
    Replies: 0
    Last Post: 09-15-2003, 09:49 PM
  4. free c++ compiler?
    By sayword in forum C++ Programming
    Replies: 4
    Last Post: 09-06-2003, 10:49 PM
  5. Borland free command line compiler
    By lambs4 in forum C Programming
    Replies: 3
    Last Post: 03-25-2002, 08:16 PM