Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C99 Question

Reply
Thread Tools

C99 Question

 
 
Pacher R. Dragos
Guest
Posts: n/a
 
      11-18-2005
This question referes to mingw compiler, a port of gcc for win32.

When I tryed yesterday to compile this code:

int test(void);

int main()
{
return 0;
}

int test()
{
for( int i = 0 ; i < 5 ; i++ );
return 0;
}

i got the following error: "something about C99 standard"
then I changet the code like that:
int i = 0;
for( i, ..)

and the error was gone.

It was strange. When I tryed to reproduce it with the latest compiler
from mingw I couldn't do it, so I'm asking if that was a bug or just a
misconfiguration.

In my large projects this is not happening. Maybe I should post it to
mingw newsgroup but it referes the C99 standard.

If anyone has encountered this kind of 'strange error' please let me
know.

 
Reply With Quote
 
 
 
 
Sriram Rajagopalan
Guest
Posts: n/a
 
      11-18-2005
Hi,

I assume the error you got was:
"error: `for' loop initial declaration used outside C99 mode"

You do not seem to have enabled the C99 mode here. Hence the error.

Enable the C99 mode, by using the compiler option "-std=c99".

Hope that helps.

Regards,
Sriram.

 
Reply With Quote
 
 
 
 
Pacher R. Dragos
Guest
Posts: n/a
 
      11-18-2005

Sriram Rajagopalan wrote:
> Enable the C99 mode, by using the compiler option "-std=c99".
>
> Hope that helps.
>
> Regards,
> Sriram.


Yes. That was the problem, and in my projects it didn't happened
because they had that compiler command. This can be reproduced only
outside the projects.
In individual files without that command, I discovered after some
digging.
Thanks for the answer.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between "library parts" of C99 and "language parts" of C99 albert.neu@gmail.com C Programming 3 03-31-2007 08:14 PM
C99 struct initialization (C99/gcc) jilerner@yahoo.com C Programming 3 02-20-2006 04:41 AM
C99 Question Vijay Kumar R Zanvar C Programming 110 01-12-2004 06:38 PM
newbie C99 question Mark Bruno C Programming 1 12-30-2003 07:00 AM
C99 question Joona I Palaste C Programming 3 10-16-2003 03:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57