Q:

Can't compile C program using Windows 7 command prompt and MinGW

I am having a really tough time trying to compile this code running command prompt in Windows 7 using MinGW:
#include <stdio.h>

int main(void) 
{

    int num;
    num = 1;

    printf ("I am a simple ");
    printf ("computer. \n");
    printf ("My favorite number is %d because it is first. \n", num);

      
    return 0;
}

I run command prompt as administrator. I set the user path environmental variable (not the system path variable) to the local MinGW. I place first.c (this above source code) into C: directory.  I've tried the following commands with directory set to C:
gcc first.c

gcc C:/first.c

but get:

gcc: error:  first.c: No such file or directory
gcc: fatal error: no input files
compilation terminated

I'm not sure what I'm doing wrong. I've tried troubleshooting quite a bit using previous Stackoverflow questions and elsewhere, but just can't seem to get it.

A:

That's most likely because you are saving it as a "Text Document", and not "All Files".
Open Wordpad, click on "File", click on "Save As", and select "All Files" in "Save as type" field.

