Archived

This topic is now archived and is closed to further replies.

billybob

baffling compiler error

Recommended Posts

(i ommitted a bunch of code, since it doesn't mean anything, just the transformation of y and z)
XVector * VecTransform(XVector * Out, XVector * v, XMatrix * Mats, float * Weights, int Num)
{
	if(Out)
	{
		Out->x = 0.0f;
		Out->y = 0.0f;
		Out->z = 0.0f;
		for(int i = 0; i [ Num; i++)
		{
			Out->x +=(v->x *Mats[i]->_11 +
				  v[i]->y *Mats[i]->_12 +
...
   
i get this error: error C2819: type 'XVector' does not have an overloaded member 'operator ->' now, the baffling part is that it does NOT happen on these lines: Out->x = 0.0f; Out->y = 0.0f; Out->z = 0.0f; only once its inside the for loop, then all of my classes' access are errors, vectors, matrices, quaternions, colors, whatever. but it only seems to happen once its inside the for loops/if blocks/some other level of scope. [edited by - billybob on January 19, 2003 10:37:56 PM] [edited by - billybob on January 19, 2003 10:38:29 PM]

Share this post


Link to post
Share on other sites
every '->' in the for loop is that error

also, i replaced the 'i < Num' in the for loop with [ in an attempt to get rid of the italics, but it just went to the next '<'

[edited by - billybob on January 19, 2003 10:52:48 PM]

Share this post


Link to post
Share on other sites
Check your code (first off, it didn''t come out to well):
Out->x +=(v->x *Mats->_11 + v[i]->y *Mats[i]->_12 +

Notice how you do... v->x, then do v[i]->y... and by judging by what you''re trying to accomplish.. neither is correct.

Should read.. v[i].y, and v[i].x (unless you are actually using an array of pointers, which I doubt). This may be a similar problem in your Mats[i]._11, and Mats[i]._12

Share this post


Link to post
Share on other sites
quote:
Original post by scaught
If I'm making the right assumptions about your code, youe problem is there because you're dereferencing the array elements. You don't need the * in front of *Mats[ i ].


thats a multiplication symbol, it looks like it because it took out my tab's to format it nicely
quote:

Check your code (first off, it didn't come out to well):
Out->x +=(v->x *Mats->_11 + v->y *Mats[i]->_12 +


it took out the [ i ] from v->x because it thought it was an italics tag


edit: lol, see now it took it out of the v->y because it thinks that is the next italics tag

most of this stuff is the forum mutilating my code

[edited by - billybob on January 20, 2003 1:39:09 AM]

[edited by - billybob on January 20, 2003 1:41:47 AM]

Share this post


Link to post
Share on other sites
they are pointers though, i'm pretty sure '.'s only work with "scoped instances" or whatever you would call it.

edit: guess not, thanks

[edited by - billybob on January 20, 2003 2:10:13 AM]

Share this post


Link to post
Share on other sites
The error was the reason for my first hasty reply, and the AP's suggestion:

error C2819: type 'XVector' does not have an overloaded member 'operator ->'

that's implying you're using a -> on a XVector instance, not a pointer to an XVector. So, somewhere, you have a dereferencing going on that you're not intending.

(I've all but given up trying to read your code Try using [ source ] and [ /source ] tags next time...)

edit: hey, no fair editting while I'm posting. heh.

[edited by - scaught on January 20, 2003 2:11:44 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by billybob
they are pointers though, i''m pretty sure ''.''s only work with "scoped instances" or whatever you would call it.
The problem is that the []s already take away one level of indirection, so it''s not a pointer by the time it gets to the ->.

Share this post


Link to post
Share on other sites
quote:
Original post by Beer Hunter
The problem is that the []s already take away one level of indirection, so it''s not a pointer by the time it gets to the ->.


oh ok, thats good to know

Share this post


Link to post
Share on other sites