unresolved external symbol HELP!!!
Hi,I hope someone can help me
I created a class for a pong game and for some reason whenever I try to call a function of the class I get this error
ETPMain.obj : error LNK2001: unresolved external symbol "class CBall NinjaStar" (?NinjaStar@@3VCBall@@A)
and i have this in my main header file
extern CBall NinjaStar;
then i try to use it like this to get the x velocity of the ball
move_rate=NinjaStar.GetXVeloc();
and it gives me the error.
oh by the way GetXVeloc() is a public function and i''m trying to make it return a private member of the NinjaStar class
please someone help!!!
thanks alot
NiNo
extern CBall NinjaStar;
that just makes the compiler aware that there is such an object. it doesn''t declare the object itself.. you need to declare CBall NinjaStar; in a .cpp file..
(i think that''s your problem.. if not, please respond with more info and i''ll try to help)
Gruad the Dealy Lama
"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop
that just makes the compiler aware that there is such an object. it doesn''t declare the object itself.. you need to declare CBall NinjaStar; in a .cpp file..
(i think that''s your problem.. if not, please respond with more info and i''ll try to help)
Gruad the Dealy Lama
"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop
=======================================Matt Welch"What sounds to you like a big bloat of trashy old noiseis in fact the brilliant music of a genius--myself" ~ Iggy Pop
thansk for replying i forgot to say that i created the instance like this
CBall NinjaStar("images/ball.bmp", 400, 200, -10, 10);
CBall NinjaStar("images/ball.bmp", 400, 200, -10, 10);
hmm... well, it seems that the compiler can't find NinjaStar..
unresolved external symbol errors are linker problems, not compiler problems (it compiles to the object files fine, and just can't link it to an executable, right?) are you not linking the object file that contains NinjaStar? that's the only thing i can think of that it might be...
oh, and NinjaStar is a global variable, right?
Gruad the Dealy Lama
"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop
Edited by - the Dealy Lama on November 21, 2000 7:38:32 PM
unresolved external symbol errors are linker problems, not compiler problems (it compiles to the object files fine, and just can't link it to an executable, right?) are you not linking the object file that contains NinjaStar? that's the only thing i can think of that it might be...
oh, and NinjaStar is a global variable, right?
Gruad the Dealy Lama
"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop
Edited by - the Dealy Lama on November 21, 2000 7:38:32 PM
=======================================Matt Welch"What sounds to you like a big bloat of trashy old noiseis in fact the brilliant music of a genius--myself" ~ Iggy Pop
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement