What command does one have to enter at the command line in Windows 7 to compile a basic C program?
Like I am literally wondering what you type in the command prompt, to
I had the same problem with .c files that contained functions (not main()
of my program). For example, my header files were "fact.h" and "fact.c", and my main program was "main.c" so my commands were like this:
E:\proj> gcc -c fact.c
Now I had an object file of fact.c (fact.o). after that:
E:\proj>gcc -o prog.exe fact.o main.c
Then my program (prog.exe) was ready to use and worked properly. I think that -c
after gcc
was important, because it makes object files that can attach to make the program we need. Without using -c
, gcc ties to find main in your program and when it doesn't find it, it gives you this error.