Message-ID: <37B01973.6C893957@aol.com> Date: Tue, 10 Aug 1999 08:22:16 -0400 From: Chris Russ Organization: Reindeer Games, Inc. X-Mailer: Mozilla 4.5 (Macintosh; U; PPC) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,comp.graphics.algorithms Subject: Re: struct problem References: <37AF8A0F DOT 7FAA AT ns DOT sympatico DOT ca> Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 32.100.213.78 X-Trace: 10 Aug 1999 12:25:17 GMT, 32.100.213.78 Lines: 63 X-Notice: Items posted that violate the IBM.NET Acceptable Use Policy X-Notice: should be reported to postmaster AT ibm DOT net X-Complaints-To: postmaster AT ibm DOT net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com It sounds like he's run across problems with the version of YACC in his compiler... Do you think the p000 is turning into an ascii null? Shades of octal... Klaas wrote: > Matthew Heyman wrote: > > > > All right.... I have a struct declared like this in a header file. > > > > typedef struct > > { > > int x; // x > > int y; // y > > int z; // z > > } vert_3d; > > > > Within the main .cpp file I have this declaration as a global. > > > > vert_3d p000; > > p000.x = 0; > > p000.y = 10; > > p000.z = 20; > > > > After compiling the program I get an error that says there is a syntax > > error in this line and every one after. > > > > p000.x = 0; //syntax error before '.' > > > > This error happens on every single declaration of the program in every > > single struct I use. The program gives no problems with the struct > > declarations, only on the variable assignments themselves. > > > > Thanks for any help. > > Is this entire code snippet global? You can't assign variables outside > of a function - you can only declare vars (with the option to > initalize). > > Try this micro-program. If it doesn't work, then there is something > worng with your compiler: > > // ------------- Struct test > #include > > typedef struct { > int x,y,z; > } vert_3d; > > vert_3d p000; > > void main() { > > p000.x=0; > p000.y=10; > p000.z=20; > > printf("%d %d %d\n",p000.x,p000.y,p000.z); > > exit(0); > > }