Search code examples
cgccgcc-warning

eclipse C compiler does not recognize // in line comments


Ok, this is the problem: I use yoxos to keep my eclipse up to date: and the other day I was upgraded to Mars .2 my C compiler (GCC tool Chain) stopped accepting '//' as comment lines, I checked other projects which had no errors, now have the same error:
Description...................Resource..Path............................Location...Type
expected expression before '/' token demo.c /demo1/Host line 98 C/C++ Problem

(93)       /* STOP FLYING! */
(94)    
(95)    printf("\n END OF THE LINE******************************** %4d \n", count );
(96)    PLatLon( dlat, dlon );
(97)    /* print"</body></html>"; */
(98)    // now return
(99)    return(1);}

I there a freaken switch somewhere that got flipped/set wrong?


Solution

  • This is from my console:

    gcc -I"/mnt/MyData/home/harrison/NexGen/Code-Base/NAV/Server/demo1/NAV_Includes" -O0 -g3 -Wall -c -fPIC -lm -fmessage-length=0 -ansi -fPIC -MMD -MP -MF"Host/demo.d" -MT"Host/demo.o" -o "Host/demo.o" "../Host/demo.c

    1. List item: Project --> Properties --> C/C++ Build --> Settings find the Tool Settings tab and change the GCC C Compiler dialect --> Language Standard. You need c99.
    2. List item: Project --> Properties --> C/C++ Build --> Settings find the Tool Settings tab -> Miscellaneous uncheck Support ANSI programs

    Now my // errors are gone!