Sign in to follow this  
SonicD007

my game engine is annoying me, it works though

Recommended Posts

Well yea, im using a game engine from my book, and i set everything up getting ready to use it, and i compile it, but of course nothing works for me *sigh* anyway, i linked the right libraries that i needed, but still no luck :( any clue why it wont work? Heres the error message. [CODE] [Linker error] undefined reference to `SpriteCollision(Sprite*, Sprite*)' [Linker error] undefined reference to `SpriteDying(Sprite*)' [/CODE] I know the game engine works because the examples in the book work. Can someone plz help poor sonic =( C++ Windows API Ill give you the game engine code if you need it to see what the problem is. Just ask for it.

Share this post


Link to post
Share on other sites
the linker telling you that he cannot reference the prototype used "SpriteCollision" and "SpriteDying" to any object file created.

that mostly means :
1. you did not include and compile all the C/CPP file in your project.
2. you did not link a .lib file needed to be linked with your engine.

allways remember that a compile create undepended object file per C/CPP file.
a linker then link all of the objects that the compiler created + already made object file to a single executable file. after linking the linker validate and reference each function that is contained in diffrenete object file then the current object.

hope thats clear enough,
Cheers,
Nuno1

Share this post


Link to post
Share on other sites
"[Linker error] undefined reference"

That means that you have the prototype declared someplace, but there is no actual implementation. So it compiles fine, but the linker throws a fit.

1) Make sure you've adding ALL the .cpp or .c files to your project.
2) Make sure you're including all the required headers.
3) It could be that the implementation is in a .lib or .a file, instead of a .c or .cpp file. Make sure you've linked with the proper libraries.

Edit: Always beaten :(

Share this post


Link to post
Share on other sites
Well as far as including libraries goes, I got that done correctly because the book only uses two libraries. winmm and msimg or something like that.

The cpp files I am 100% sure ive included the files i needed.

The header files same as cpp files.

I'm gonna triple check that I #include the correct things to each other and stuff, but I know I checked that too... This is so annoying >.<

P.S. I'm seriously considering showing everyone my code because this is really getting me pissed off XD Also, how do i show the code in that white box that has the scroll bars on a post??

Anyway, thanks for the advice on checking to make sure everything is included. Don't know what I left out if anything. :-
Edit: SCET!!!! Did u get my pm???????????? I need help with that too. Thats an important step to what im making. =(

Share this post


Link to post
Share on other sites
sonic, this does not seems line an #include error. most of the case #include error will cause compilation error (but if you have done an implementation in the .h file then it may be).

search for the implementation of SpriteCollision and not the prototype.
find the file that containing this function and validate you compile it and link it.

if it still does not work it may be an #ifndef kind of a problem.

if you like , post the SpriteCollsion function (but all of the .c/cpp file) and I can validate it is not under an #ifndef/ifdef kind of thing.

Nuno1

Share this post


Link to post
Share on other sites
Quote:
Original post by SonicD007
Edit: SCET!!!! Did u get my pm???????????? I need help with that too. Thats an important step to what im making. =(


Yes I did and I PM'd you back(although it's kind of useless, cause of this thread). I know what you're trying to do, but get this working first.

Share this post


Link to post
Share on other sites
I am soooooo slow -_- I got my sprite class to stop pissing me off finally :) I didn't realize that I had to state void blah blah blah in my game code like I did with the Game Engine functions. I thought it was part of the Sprite class, but something else.

(I'm not very good with classes :-\ I think i better go brush up on my skills with classes)

ANYWAY...now that I got this working I can FINALLY start working on my game!!! WOOHOO!


well better be off to solve my mapping problem with tile studio :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this