Thread: gcc

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Unhappy gcc

    I have a windows computer and I'm completely new to C programming. I was trying to install gcc but the instructions on the websites are too complicated for me. Someone also directed me to MinGw. What is the difference between the two? How to I get a compiler to work?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    "mingw" is a "minimal Gnu For Windows", which is a set of changes to the original gcc tool chain to allow it to work on Windows. And that's most likely what you want.

    So essentially, gcc and gcc-mingw would be the same thing if you want to develop in a Windows environment.

    There is a "Cygwin" variant of gcc as well - cygwin is a much more complete set of tools to make a Windows system appear like a Unix/Linux system - you probably do NOT want this.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    How would I install MinGw then? Sorry, I'm trying :blush:

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You will probably want an IDE (which is an editor and debugger interface to make life really easy on your development effort), so the best solution is probably to download Code::Blocks from here:
    http://www.codeblocks.org/downloads/binaries

    There are two choices, one "with" and one "without" mingw - you want the larger one "with". It comes with a nice installer that does everything you need for you.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Unhappy

    My brother says that I'm not allowed to use an IDE. I did install MinGW, so now do I just do the normal gcc "program.c" and stuff or is there another way. Also, I did not do the manual install.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Poincare View Post
    My brother says that I'm not allowed to use an IDE. I did install MinGW, so now do I just do the normal gcc "program.c" and stuff or is there another way. Also, I did not do the manual install.
    Well, bring your brother over here and I'll give him a slap! Or at least ask him to give you a reasonable answer as to why you should not use an IDE. We do not believe in "learning to tie shoelaces with one hand" type exercises, which not using an IDE is.

    Using "notepad" to edit files is a stupid way to write code, and you didn't start writing code 20 years ago (I presume), so you do not know from historics how to use Emacs or VI. You WILL need a "programmers editor", and the simplest version is the ones that come bundled with gcc-mingw.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Smile

    ok! So, now that I've already installed MinGW, and CodeBlocks without MinGW, then how do I configure it to work with MinGW? Also, just for my knowledge, how would I configure MinGW to work with the command line?

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    To configure MinGW to work from the command line, you would just need to change your path variable to include MinGW's bin directory. CodeBlocks allows you to choose which compiler -- go to settings and compiler, and there at the top is a drop-down list to choose from.

  9. #9
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    For a simple start just type the full path name for ggc mine is:=
    C:\MinGW\bin
    so
    >C:\MinGW\bin\gcc cfile.c -o cfile.exe
    should do something.
    Then right click on mycomputer-properties - advanced - enviroment variables
    and add C:\MinGW\bin; to the end of the path variable and then you can just type

    >gcc cfile.c -o cfile.exe

    And it will find it automatically.

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    Do I need to be admin to change the enviroment variable?

  11. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yes, but there is a user specific path variable that you can modify.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #12
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Unhappy

    Even though I set the path system variable (not the user one), it still won't work!
    Should I try setting the path user variable?

    EDIT: It doesn't work even if I set the user path variable either. Please help!
    Last edited by Poincare; 01-20-2009 at 12:08 PM.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Poincare
    Even though I set the path system variable (not the user one), it still won't work!
    How does it not work? Are you sure that the path is correct? For good measure, you could restart your computer.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by Poincare View Post
    Even though I set the path system variable (not the user one), it still won't work!
    Should I try setting the path user variable?

    EDIT: It doesn't work even if I set the user path variable either. Please help!
    Can you compile if you specify the full pathname eg >C:\MinGW\bin\gcc?


    That's all you need to do

  15. #15
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    I can do it if I go to the specific directory, but that gets pretty annoying after the second time! Please help! I really don't want to ask my brother. I think he wanted me to install CYGWin

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Replies: 4
    Last Post: 09-02-2007, 08:47 PM
  3. Compiles on gcc 3.3 but not on gcc 4.0.3
    By cunnus88 in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2007, 12:24 PM
  4. gcc configuration under linux advice needed
    By vart in forum Tech Board
    Replies: 9
    Last Post: 01-10-2007, 02:46 PM
  5. gcc
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 10-22-2003, 03:46 PM