Advertisement

baffling compiler error

Started by January 19, 2003 09:37 PM
12 comments, last by billybob 21 years, 10 months ago
(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->_11 +
				  v->y *Mats->_12 +
…
   </pre>   
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 &#111;n these lines:

		Out->x = 0.0f;
		Out->y = 0.0f;
		Out->z = 0.0f;

only &#111;nce its inside the for loop, then all of my classes' access are errors, vectors, matrices, quaternions, colors, whatever. but it &#111;nly seems to happen &#111;nce its inside the for loops/if blocks/some other level of scope.     </i>  

<SPAN CLASS=editedby>[edited by - billybob &#111;n January 19, 2003 10:37:56 PM]</SPAN>

<SPAN CLASS=editedby>[edited by - billybob &#111;n January 19, 2003 10:38:29 PM]</SPAN>    
maybe you should post the line that the error is on.
Advertisement
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]
actually, it appears to only happen on arrays, using the []. but i used the same syntax in other functions (at least i''m 99% sure)
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.<br>
Check your code (first off, it didn''t come out to well):
Out->x +=(v->x *Mats->_11 + v->y *Mats->_12 +<br><br>Notice how you do… v->x, then do v->y… and by judging by what you''re trying to accomplish.. neither is correct.<br><br>Should read.. v.y, and v.x (unless you are actually using an array of pointers, which I doubt). This may be a similar problem in your Mats._11, and Mats._12 </i>
Advertisement
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.<br> <hr height=1 noshade></SPAN></BLOCKQUOTE> <br>thats a multiplication symbol, it looks like it because it took out my tab's to format it nicely<br><BLOCKQUOTE><SPAN CLASS=smallfont>quote:<hr HEIGHT=1 noshade><br>Check your code (first off, it didn't come out to well):<br>Out->x +=(v->x *Mats->_11 + v<i>->y *Mats->_12 +<br> <hr height=1 noshade></SPAN></BLOCKQUOTE> <br>it took out the from v->x because it thought it was an italics tag </i> <br><br>edit: lol, see now it took it out of the v->y because it thinks that is the next italics tag<br><br>most of this stuff is the forum mutilating my code<br><br><SPAN CLASS=editedby>[edited by - billybob &#111;n January 20, 2003 1:39:09 AM]</SPAN><br><br><SPAN CLASS=editedby>[edited by - billybob &#111;n January 20, 2003 1:41:47 AM]</SPAN>
quote: Original post by billybob
thats a multiplication symbol

That''s what I get for reading & replying to posts inbetween builds. Sorry.
replace them with .''s?
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]

This topic is closed to new replies.

Advertisement