Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Trying to compile Gerbil with gcc

Author: Angrim

Date: 22:09:53 12/17/01

Go up one level in this thread


On December 17, 2001 at 16:06:48, Dann Corbit wrote:
>On December 16, 2001 at 08:13:26, James Swafford wrote:
<snip>
>>I don' think gcc cares about " // ", but I'm actually using g++ now,
>>so I can't remember for sure.
>
>For C code, it's an error (won't even produce an object).  For C++ code, it's
>not a problem (of course).
>
>dcorbit@DANNFAST c:/tmp
>$ cat foo.c
>#include <stdlib.h>
>#include <stdio.h>
>#include <time.h>
>int main(void)
>{
>   srand((unsigned)time(NULL));
>   // pseudo-random number
>   printf("%d\n", rand());
>   return 0;
>}
>
>dcorbit@DANNFAST c:/tmp
>$ gcc -Wall -ansi -pedantic -O3 foo.c
>foo.c: In function `main':
>foo.c:7: parse error before `/'
>

Passing the -ansi flag turns off the gcc extensions to the ansi C standard,
and as such of course it won't accept // style comments.  Just compile
without passing -ansi.

Angrim



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.