Error LNK2019, SDL_IMG, SLD_LoadTexture. Unsolvable problem.

Started by
20 comments, last by DejaimeNeto 10 years, 1 month ago

if (renderer = NULL) {...

You are attributing NULL to the renderer here, I am sure you meant to use == .
I have done this several times.

Same with the quit test...

Didn't your compiler spit a warning about this?

ah, this solved my first error, no it didnt. which was odd. It compiles with no errors or warnings. except for the break, which is now happening here.


SDL_Renderer *CSDL_Setup::GetRenderer()
{
	return renderer;
}

more specifically


return renderer;

EDIT:

interestingly enough if I have:


csdl_setup = new CSDL_Setup(&quit);

it breaks in the original place.

however:


csdl_setup == new CSDL_Setup(&quit);

"==" causes it to break in the return renderer; function.

any known reason to why == and = are different or did i just missing something from my books and studies?

Advertisement

It would be easier to understand your code if you placed it (in its entirety) somewhere like PasteOfCode or Gist.

The CSDL_Setup class declaration would be great, while the context where you call the problematic GetRenderer() function would also help. It doesn't seem like something that should break that way...

btw, what compiler are you using? All compilers I know show a warning when attributing something somewhere where a "truth value" should be; unless their warnings are suppressed manually.

It would be easier to understand your code if you placed it (in its entirety) somewhere like PasteOfCode or Gist.

The CSDL_Setup class declaration would be great, while the context where you call the problematic GetRenderer() function would also help. It doesn't seem like something that should break that way...

btw, what compiler are you using? All compilers I know show a warning when attributing something somewhere where a "truth value" should be; unless their warnings are suppressed manually.

SDL_Setup.cpp http://paste.ofcode.org/h7TiTsMNJLQK9U57k9Xw7q

SDL_Setup.h http://paste.ofcode.org/9qem9BMGWj8TcqcFMFQEZJ

Game_Loop.cpp http://paste.ofcode.org/x4KRbXXgAvACvi9ch46vjx

Game_Loop.h http://paste.ofcode.org/DSpAvqcgDGQ66MEY6jKvEA

Im using visual studio 2013. If it is showing them, im seeing them no-where, and I know it used to throw warnings in 2010.

The problem can be here:


player = new CSprite(csdl_setup->GetRenderer(), "Z:\My Documents\Visual Studio 2013\Projects\SDL tuts 1\face.bmp", 0,0,200,200);

"...\face.bmp". Try swapping all your \ with '/' or '\\' and trying again. The path is probably being misinterpreted...


player = new CSprite(csdl_setup->GetRenderer(), "Z:/My Documents/Visual Studio 2013/Projects/SDL tuts 1/face.bmp", 0,0,200,200);

The problem can be here:


player = new CSprite(csdl_setup->GetRenderer(), "Z:\My Documents\Visual Studio 2013\Projects\SDL tuts 1\face.bmp", 0,0,200,200);

"...\face.bmp". Try swapping all your \ with '/' or '\\' and trying again. The path is probably being misinterpreted...


player = new CSprite(csdl_setup->GetRenderer(), "Z:/My Documents/Visual Studio 2013/Projects/SDL tuts 1/face.bmp", 0,0,200,200);

that did give me a warning, i just didn't get around to changing it, but it still breaks.

Now I'll ask you for your CSprite class; I hope you don't mind!

interestingly enough if I have:

csdl_setup = new CSDL_Setup(&quit);

it breaks in the original place.

however:

csdl_setup == new CSDL_Setup(&quit);

"==" causes it to break in the return renderer; function.

any known reason to why == and = are different or did i just missing something from my books and studies?

Didn't see this earlier.

== is a comparison, while = is an attribution.

This:

x = 1

means that you want x to be 1, and now it is.

x == 1

means that you want to know if it is 1.

So, == is comparing two things,

while = is modifying the left one's value to be the same as the right one.

When I said the quit test, I meant this one:


if (*quit = true)

Now I'll ask you for your CSprite class; I hope you don't mind!

interestingly enough if I have:

csdl_setup = new CSDL_Setup(&quit);

it breaks in the original place.

however:

csdl_setup == new CSDL_Setup(&quit);

"==" causes it to break in the return renderer; function.

any known reason to why == and = are different or did i just missing something from my books and studies?

Didn't see this earlier.

== is a comparison, while = is an attribution.

This:

x = 1

means that you want x to be 1, and now it is.

x == 1

means that you want to know if it is 1.

So, == is comparing two things,

while = is modifying the left one's value to be the same as the right one.

see, thats what i thought. But it confuses my why visual studio 2013 wouldn't throw me a warning about that in an if check.

Sprite.cpp http://paste.ofcode.org/xDsSHHcNbL8YWhjscfkWnh

sprite.h http://paste.ofcode.org/u8Jb28PZAUTux7PfrhJG8Y

Would you try this modified version?

http://paste.ofcode.org/gaDCuxtcxt5q6HWRjTLnXb

and tell me what happens?

Would you try this modified version?

http://paste.ofcode.org/gaDCuxtcxt5q6HWRjTLnXb

and tell me what happens?

Well, it just continues to fail at the same point.


return renderer;

I'm unable to see a consol or anything.

Are you sure the csdl_setup is a valid pointer? Where is it constructed?

This topic is closed to new replies.

Advertisement