error LNK2001: unresolved external symbol

Started by
34 comments, last by falcon93 12 years, 8 months ago
In GraphicsEngine::Draw you dod3ddev->SetTexture(0, texture); but the texture has never been initialized. If I'm not missing something this could cause the program to crash. I don't use windows so I can't test your code so it could be other things that cause the crash. Visual Studio 2010 has a debugger as far as I know. Try using that and see what you find.
Advertisement

In GraphicsEngine::Draw you dod3ddev->SetTexture(0, texture); but the texture has never been initialized. If I'm not missing something this could cause the program to crash. I don't use windows so I can't test your code so it could be other things that cause the crash. Visual Studio 2010 has a debugger as far as I know. Try using that and see what you find.


But it should check these thing automaticly, right? The problem is that I don't get any debug messages or crash help at all, just a crash which has to be quitted by Ctrl + alt + delete sad.gif

I'll check the code part you mentioned asap smile.gif
Was awhile I programmed in C++ but if you do it like this
[color="#1C2837"][font="CourierNew, monospace"][color="#660066"]GraphicsEngine[color="#666600"]*[color="#000000"] graphics [color="#666600"]= [color="#000088"]new [color="#660066"]GraphicsEngine[color="#666600"](); [color="#880000"]// This will create a new object of my GraphicsEngine.[/font]
[color="#660066"]Player[color="#666600"]*[color="#000000"] player[color="#666600"]; [color="#880000"]// I create my sprite object in the Player class constructor, just to simulate the situation in my game. The Sprite requies variables from GraphicsEngine, therefore: [font="CourierNew, monospace"][color="#000000"]player [color="#666600"]= [color="#000088"]new [color="#660066"]Player[color="#666600"]([color="#000000"]graphics[color="#666600"]); [color="#880000"]// I send a reference. Not a new object or "copy"?[/font][/quote]

and receive the pointer like this
[color="#1C2837"][font="CourierNew, monospace"][color="#660066"]Player[color="#666600"]::[color="#660066"]Player[color="#666600"]([color="#660066"]GraphicsEngine[color="#666600"]&[color="#000000"] graphics[color="#666600"]) [color="#880000"]// I can use/write GraphicsEngine + & without having to include the .h file?[/font][color="#666600"]{ [color="#660066"]Sprite[color="#000000"] sprite [color="#666600"]= [color="#000088"]new [color="#660066"]Sprite[color="#666600"]([color="#000000"]graphics[color="#666600"]); [color="#880000"]// Sends a reference to the sprite object

[color="#666600"][font="CourierNew, monospace"]}[/font][/quote]

that would mean a reference to the pointer? so to fix it you add a dereference before. player = new Player(*graphics)

or you just takes a GraphicsEngine * instead.
Check what things automatically? I think Windows will show an error message if the program crashes and you should not have to use Ctrl Alt Delete. Maybe the program gets stuck in an infinite loop?

But it should check these thing automaticly, right?


Not necessarily.

In a perfect world, every system we use in programming would be polite and tell us when we do something wrong. In reality, that's very expensive and doesn't happen often. Therefore, the deep wisdom: "be tolerant in what you accept, and strict in what you produce." In other words, you should write programs that assume they will be given bad inputs, and respond gracefully. At the same time, you should never assume that other people are doing this; always make sure your outputs are sane before you give them to other parts of the program or other APIs/libraries/etc.


Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Sorry for a late reply :/

I'll take a look at this asap, I'm back as soon as I've tested. And thank you all very much for your help :)

This topic is closed to new replies.

Advertisement