(Note : I'm still a beginner when it comes to programming, so sorry if it's something obvious)
So, when I try to print out the value of one of my function arguments of the type sf::String my entire application crashes with the error message ;
Exception thrown at 0x0FDE6D16 (msvcp140d.dll) in SwEngine.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC.
If there is a handler for this exception, the program may be safely continued.
I believe that a conversion between a std::String (which I send in to the function parameter of the type sf::String) fails, which leads to a crash, because when i try to use this sf::String value as a window title, the title is blank.
Here's some code :
This is the function which contains the sf::String value, and here's where the program crashes.
void Window::Create(unsigned int width, unsigned int height, sf::String title)
{
std::cout << title.toAnsiString() << std::endl; // Crashes here.
}
And here's how I call that function :
Window::GetInstance().Create(1024, 720, globals::GAME_NAME);
And this is what the GAME_NAME variable is :
namespace globals
{
// The name of the game the engine is currently running.
const std::string GAME_NAME = "SwEngine Testing";
}
I'm pretty confused since it says in the SFML page that it handles conversions between the 2 string automatically, so, am I doing something very wrong here?