I'm new to SFML, but have decent programming background.
I'm using Visual Studio 2019 and have run into a very strange bug. I've narrowed the code down to the following:
#include <SFML/Graphics.hpp>
int main() {
sf::Texture ship;
ship.loadFromFile("ship.png");
return 0;
}
The code builds with no problem. When I build it in debug mode it fails. When I build it in "release" mode it works and opens the file to load the Texture object.
The output that I see on the console is a message from the loadFromFile() method. It says "Failed to load image "....". The contents in the quotes will include the "ship.png" preceded by four characters and succeeded by a randomly sized list of characters. It looks to me like the string address received/used by the loadFromFile() method is not correct. I'm wondering if it's a problem with the stack or something related to the fact that the parameter is passed by reference and the reference address is reduced by four bytes (thus the consistently preceding four meaningless chars before the actual file name).
Here's the output from a run in debug mode:
Failed to load image "╚> ♥ship.pngßÑ│2►☼2►çL°╛α≈╛.ßÑ│2►ç┤°╛►▐2►ç┤°╛►▐Ç-~x┬Fe╦■ ♀°╛♀°╛e√qx↑°╛│εqx≡╘☺║↕4°╛4°╛<¶rx4°╛│εqx≡╘☺║↕P°╛P°╛<¶rx2►ç0┴εÇ.<u╠This goes on for several pages with looks like a non-terminated string that is read past the end of the string into local memory after the string.
Here's the output when I build the project using a release build instead of debug build.
C:\Users\pat.smith\source\repos\careful test sfml\Release\careful test sfml.exe (process 33828) exited with code 0.Any ideas on where to look next?
TIA!