Reputation: 11
Complete Novice alert :
#include<stdio.h>
int main()
{ puts("C Rocks!");
return 0;
}
When compiled with MinGW, it shows two errors:
What is wrong with the code?
Upvotes: 1
Views: 1728
Reputation: 334
I was also having this issue. Check for illegal characters in the path name such as spaces or brackets. Your code looks correct so the issue isn't there. If all else fails, go back to the basics. Make sure you're actually using "gcc file.c -o file.exe" to output the correct file. For some reason, i completely forgot to use 'gcc', even though I had been using MinGW for over month.
Upvotes: 1
Reputation: 11
There's nothing wrong with your code. Is the first time you compile something? It seems to be a problem with the MingW. It can be spaces in the path, for example.
To avoid some beginner problems, you can use an IDE, like Dev-C++(http://www.bloodshed.net/devcpp.html), as it can compile C and C++ code.
Upvotes: 0
Reputation: 6606
Install mingw in a path without spaces.MinGW will experience problems with such paths. Thus, i strongly recommend that you do not install MinGW in any location with spaces in the path name reference; i.e. you should avoid installing into any subdirectory of "Program Files" or "My Documents", or the like.
Upvotes: 0