problem compiling with gcc


10 replies [Last post]
tinalovell
tinalovell's picture
Offline
Joined: 2011-12-23
Points: 0

Hello all! Well i believe that I have everything installed correctly, followed the videos step by step. but whenever i try and compile my program, this is what i receive in return from the command prompt. PLEASE HELP!

Microsoft Windows [Version 6.1.7600]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\Users\tina>gcc

gcc: fatal error: no input files

compilation terminated.

 

C:\Users\tina>cd Desktop

 

C:\Users\tina\Desktop>dir

 Volume in drive C is TI105828W0G

 Volume Serial Number is 6484-E14C

 

 Directory of C:\Users\tina\Desktop

 

05/13/2012  03:37 PM    <DIR>          .

05/13/2012  03:37 PM    <DIR>          ..

05/13/2012  03:33 PM    <DIR>          C Programming

05/10/2012  10:10 PM    <DIR>          IT Books

04/21/2012  09:57 AM    <DIR>          Music

05/13/2012  11:02 AM    <DIR>          Virtual Box & OS

               0 File(s)              0 bytes

               6 Dir(s)  154,619,838,464 bytes free

 

C:\Users\tina\Desktop>"C Programming"

'"C Programming"' is not recognized as an internal or external command,

operable program or batch file.

 

C:\Users\tina\Desktop>

__________________

Tina

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
LionMAn
LionMAn's picture
Offline
Joined: 2012-01-26
Points: 0

If the file you want to compile is in the C Programming directory. You have to do "cd desktop" then "cd C Programming" and then do "gcc filename.c -o filename.exe".

tinalovell
tinalovell's picture
Offline
Joined: 2011-12-23
Points: 0

I hve tried that, it still does not work, itwas working fine earlier but suddenly it did not work anymore

tinalovell
tinalovell's picture
Offline
Joined: 2011-12-23
Points: 0

This is what i get from the command prompt when i do what you suggested

 

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\tina>cd Desktop

C:\Users\tina\Desktop>"cd C Programming"
'"cd C Programming"' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\tina\Desktop>gcc Heybuddy.c -o Heybuddy.exe
gcc: error: Heybuddy.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.

C:\Users\tina\Desktop>

__________________

Tina

tstewart2808
tstewart2808's picture
Offline
Joined: 2012-05-15
Points: 0

Are you using the quotes(C:\Users\tina\Desktop>"cd C Programming")? If you are, try it without the quotes. 

Jackeduphard
Jackeduphard's picture
Offline
Joined: 2012-04-06
Points: 0

OK first things first. Relax you are ok and you doing fine! (the fact you are even in a Command Prompt u are kicking butt!) 

Second is about ... well second? Here is a link I had to read up on and relised i needed to grab one other thing from online and now I am compiling no problems! :) 
http://www.mingw.org/wiki/Getting_Started 

then next, I had abou the same error you had you need to make sure your Command prompt is where ever you installed MinGW too and then the file bin. Should look like this:

C:\MinGW\bin>

Thats what it should look like. Now that you are here (and you isstalled MinGW, because you shoudl not have this directory if you did not), you need to run this command:

mingw-get install gcc

And this should install all the rest and you will be fine, just dont forget to ad to the Path directory (at the end of the paths already there):

C:\MinGW\bin;

(^ this needs to be added here)

 

  1. Right-click on "My Computer" and select "Properties".
  2. Click Advanced -> Environment Variables.
  3. In the box entitled "System Variables" scroll down to the line that says "PATH" and double-click the entry.
  4. You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the PATH variable. It is very important that you do not delete the existing values in the PATH string, this will cause all sorts of problems for you!
  5. Scroll to the end of the string and at the end add ";<installation-directory>\bin". Here <installation-directory> is the full absolute path name of the installation directory; if you accepted the defaults when installing tar and gzip, then for these, it will (probably) be C:\Program Files\GnuWin32, while for MinGW it will be C:\MinGW\bin, (if you kept to the recommended default installation directory). Don't forget the semicolon; this separates the entries in the PATH.
  6. press OK -> OK -> OK and you are done.

    This is taken from:  http://www.mingw.org/wiki/Getting_Started  Environment Settings

    I hope this all helps! Best of luck.

 

 

Jackeduphard
Jackeduphard's picture
Offline
Joined: 2012-04-06
Points: 0

(Oh and side not, do not make directorys have spaces or you are going to run into issues ... like dont call the folder C Proggramming, just call it C or CLabs or something like that ... just my 00.02$)

Jackeduphard
Jackeduphard's picture
Offline
Joined: 2012-04-06
Points: 0

I hope you were able to to get your gcc going? (do you need any more help or were you able to get it up and running?) 

tinalovell
tinalovell's picture
Offline
Joined: 2011-12-23
Points: 0

Hey sorry for responding so late, but I just tried what you suggested, but unfortunately it did not work. anymore suggestions? and thank you for your help!

__________________

Tina

tinalovell
tinalovell's picture
Offline
Joined: 2011-12-23
Points: 0

Hey thanks alot, when I finally took a deep breath and calmed down as suggested and with the help of you and youtube, I discovered the problem was with defining the PATH (i was missing somethings). fixed it and now the gcc compiler is working. Thank You again!

 

 

__________________

Tina

Jackeduphard
Jackeduphard's picture
Offline
Joined: 2012-04-06
Points: 0

:D Good on you!