SFML community forums
Help => General => Topic started by: Anand on March 19, 2016, 08:34:43 am
-
i use visual studio 2015. i am creating a class textureholder to load and access the textures in sprite using std::map and on building the project gives debug assertion failed error. i have copied the image in the folder of the project.
i have attached the snapshot of the code , error, the folder of the project which i am doing.
please help me out
-
If you click retry the debugger would step in and pause the execution. Then you'd know exactly where the error happened and get a full stack trace.
The assertion also pretty much explains what's going on. You're trying to dereference a map iterator. Since there's only one dereference operator, I assume that's where error happens.
return *found->second;
Maybe that should be
return *(found->second)
-
sorry sir but the same error message appears after the modification which you have suggested.
help furthure
-
You load the airplaine texture, and then use the scene texture. Since it's not loaded, it can't be found in the map and the iterator that you get after the call to "find" is invalid, thus it can't be dereferenced.
When you hit an assertion, you can break and use the debugger to walk back the call stack, and watch variables and function arguments to find out what's wrong in your code.
-
thank you sir. it now works