MinGW doesn't like comments

I have a compilation problem using "code :: blocks" on Windows 7. My C code:

//whatever
 int main(void){return 0;}
//this is blank line

MinGW Command Line:

gcc.exe -Wall -g -ansi -c C: ... \ Test \ main.c -o obj \ Debug \ main.o

If I try to compile this, I get an error:

C:\...\Test\main.c|1|error: expected identifier or '(' before '/' token

(I wanted to post an image here, but not enough reputation ...)

There are only 3 lines of code in my source file. (The latter just contains \0, but I did not know how to add an empty string). I use code::blocksas an IDE. I used notepad++to search for non-printable characters, but without meaningful results. I use the compiler MinGW, which is available bundled using the :: blocks code. I fixed "toolchain executables"it and the compiler worked so far.

, . , , ( ).

, , - ( ). , .

, . .

! , Nils

+4
3

-ansi.

ANSI C //.

gcc documentation:

3.4 C

[...]

-ansi

C -std = c90. ++ -std = ++ 98.

[...] C ++ '//comments [...]

+4

, . ( , . -ansi.)

Settings->compiler

Settings-> compiler

+3

To compile c use

/* C-style comments!
 */
0
source

All Articles