Thread: Problems with MinGW

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    12

    Problems with MinGW

    Im trying to do a tutorial and it says to install MinGW to use GCC. I have installed minGW to my external hdd and also to my internal hdd.
    The tutorial says that i must add the compiler to the PATH environmental variables so i can run it better in cmd.
    Im adding "c:\mingw\bin" (without the quotes) to the end of the my path variable. But when i run cmd and type in "gcc" like the tutorial saysim getting this message:
    " 'gcc' is not recognized as an internal or external command,
    operable program or batch file."

    The tutorial says that if an error message comes up, to repeat the step. However, i have followed the step 5 times and the same message comes up.
    Should i use a different compiler? do all compilers run in the Command line or CMD?
    im really confused because im just starting out, like a previous post of mine has stated already.
    Thanks for any help.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,667
    Where exactly did you add the PATH variable (system properties?)

    You might have to at least log out and log back in again under windows, or force explorer to restart.

    Type 'set' at the command prompt to check what is in the path when the console is opened.

    You could also try to set the path directly in the console by doing something like
    PATH=c:\mingw\bin;%PATH%
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    1. Make sure c:\mingw\bin is where your gcc executable lives.

    2. At your command prompt, type "echo %PATH%" (without quotes, natch) and make sure it's what you want it to be. You should see lots of folders separated by semicolons.

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    Okay thanks, i will try those and will reply with an update
    thank you

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    Okay, i have replaced the c:\mingw\bin with F:\Software\GNU Compiler Collection\MinGW, which is the location of the compiler on my external hard drive and still it comes up with the message saying it isnt an executional program :|
    Are there any other compilers i can run using the cmd or command line (not sure :P )

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Is there a gcc.exe exactly in the directory F:\Software\GNU Compiler Collection\MinGW? Not in a subdirectory (like \bin) of that directory? (Subdirectories don't count, in a path.)

    I trust you looked at your path after you started cmd to verify.

  7. #7
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    No, theres only subs and in the Bin directory theres a few application programs but none of them work. They bring up cmd for like half a second.
    And i looked at the path when the tutorial told me to edit it, then went to the cmd to see if it worked.

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So first: if gcc.exe is in the bin subdirectory, then that's what you have to use in your path. Humor me: show me the output of "echo %PATH%" from your cmd.

    Second: There's "a few" application programs in bin? I have 59 .exe files in my MinGW\bin directory, and while some of them are "extra" (like g77) I would think you had better have more than "a few". Also, if you don't give them an input file they are not happy programs, so clicking them may not give you much effect.

  9. #9
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    How do i show you the output? :P
    i mean, ive entered "echo %PATH%" but how do i get that on here?

  10. #10
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    C:\Users\Corey>echo %PATH%
    %CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Window
    s;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\10.0\DLLSh
    ared\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Mic
    rosoft SQL Server\100\DTS\Binn\;C:\Program Files\QuickTime\QTSystem\F:\Software\
    GNU Compiler Collection\MinGW

  11. #11
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So when we say "you need to use the bin subdirectory" that means you need to use the bin subdirectory. When we say "you need semicolons between your directories" that means you need to use semicolons between the subdirectories. Go back to your instructions, find the semicolon that you have ignored up to now, and use it. The end of your path needs to look like

    C:\Program Files\QuickTime\QTSystem;C:\MinGW\bin

    Make it happen.

  12. #12
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    You could type: "path > path.txt"
    (without quotes), then,
    open path.txt file with notepad and do a cut'n'paste.

  13. #13
    Registered User
    Join Date
    Jan 2011
    Posts
    12
    Ahh, thank you. Sorry for such a newbie mistake, i'll pay more attention next time. Thank you.

  14. #14
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    If you were following my guide let me know, and let me know what part confused you so I can make sure others don't make the same mistake.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Random file IO problems in MinGW GCC
    By JungleJesus in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2010, 10:53 AM
  2. SDL and mingw. Please help.
    By Erin100280 in forum C++ Programming
    Replies: 2
    Last Post: 08-15-2010, 09:26 PM
  3. Visual C++ 2010 express problems
    By dnj23 in forum Windows Programming
    Replies: 6
    Last Post: 08-10-2010, 06:16 AM
  4. Most Common problems in C
    By Bayint Naung in forum C Programming
    Replies: 18
    Last Post: 06-02-2010, 08:20 PM
  5. MinGW causing problems with sprintf()
    By sedavidw in forum C Programming
    Replies: 6
    Last Post: 01-14-2010, 05:37 AM