www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/10/14:33:48

From: Satriani <satriani AT NOSPAMthepentagon DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.os.programmer,comp.graphics.algorithms
Subject: Re: struct problem
Date: Mon, 09 Aug 1999 15:42:15 -0700
Organization: Simon Fraser University
Lines: 40
Message-ID: <37AF5947.66951F05@NOSPAMthepentagon.com>
References: <A7083B60FEDED7E0 DOT 7F2CBC07CD9B5AB8 DOT 019CE2E485CE12C4 AT lp DOT airnews DOT net>
NNTP-Posting-Host: learningaid.cs.sfu.ca
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (WinNT; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Try this instead:

vert_3d p000;
vert_3d p000 = {0,10,20};

OR, assign the vector within a function.

Justin

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.
>
> Matthew Heyman

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019