Problem with Cone3d's 1st SDL Tutorial

Started by
11 comments, last by GarlandIX 22 years, 1 month ago
I looked it up, you can declare variables in a for loop

(in the initialization part like your example)

according to C99 standard, so either his compiler is not very
compliant or it is following the old standard or something
else was amiss.
Advertisement
hmm. maybe, but I''m pretty sure that the errors

untitled1.c: In function `DrawScene'':
untitled1.c:74: parse error before `int''
untitled1.c:74: `x'' undeclared (first use in this function)
untitled1.c:74: (Each undeclared identifier is reported only once
untitled1.c:74: for each function it appears in.)
untitled1.c:74: parse error before `)''
untitled1.c:76: `y'' undeclared (first use in this function)
untitled1.c:76: parse error before `)''

refer to that for loop thingy. I remember reading from some c tutorial once that you had to manually declare your variables at the top of your programs in C. Maybe that has changed or the tutorial contained old information. I don''t really know.


---
cone3d
http://cone3d.gamedev.net
My software never has any bugs - it just generates random features
---cone3dhttp://cone3d.gamedev.netMy software never has any bugs - it just generates random features
I had the same kind of problem when porting DirectX, VisualC++ programs to g++ and SDL.
As Cone3d suggested, declare the variable controling the loop at the top of the function and not in the loop itself.
My version of gcc is quite recent, that''s the one included with Redhay7.2

This topic is closed to new replies.

Advertisement