I am unable to draw a sprite from the sf::Texture and sf::Sprite classes. All the libraries are linked, all the dll's are placed correctly and even the image is in the right location. The image is also the same size as the window. The code also has no errors. Why am I getting an exception? :(
Here's the code:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(1024,768), "Window");
sf::Texture image;
if(!image.loadFromFile("images/splash.jpg"))
{
return 0;
}
sf::Sprite sprite(image);
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
if(event.type == sf::Event::Closed)
window.close();
window.clear();
window.draw(sprite);
window.display();
}
return 0;
}
Here's the exception:
'Image.exe': Loaded 'C:\Users\WDR\Documents\Visual Studio 2010\Projects\Image\Debug\Image.exe', Symbols loaded.
'Image.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Users\WDR\Documents\Visual Studio 2010\Projects\Image\Debug\sfml-graphics-2.dll', Binary was not built with debug information.
'Image.exe': Loaded 'C:\Users\WDR\Documents\Visual Studio 2010\Projects\Image\Debug\sfml-window-2.dll', Binary was not built with debug information.
'Image.exe': Loaded 'C:\Users\WDR\Documents\Visual Studio 2010\Projects\Image\Debug\sfml-system-2.dll', Binary was not built with debug information.
'Image.exe': Loaded 'C:\Windows\System32\msvcr100.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\msvcp100.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\opengl32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\glu32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\ddraw.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\dciman32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\setupapi.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\cfgmgr32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\devobj.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Image.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'Image.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\nvoglv32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\version.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\wintrust.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\crypt32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\msasn1.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\ntmarta.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\Wldap32.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\powrprof.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x1904) has exited with code 0 (0x0).
'Image.exe': Unloaded 'C:\Windows\System32\powrprof.dll'
The thread 'Win32 Thread' (0xe38) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x6c8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xe5c) has exited with code 0 (0x0).
'Image.exe': Loaded 'C:\Windows\System32\dinput.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\hid.dll', Cannot find or open the PDB file
'Image.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
First-chance exception at 0x706b1f34 in Image.exe: 0xC0000005: Access violation reading location 0x00b15000.
Unhandled exception at 0x706b1f34 in Image.exe: 0xC0000005: Access violation reading location 0x00b15000.
The program '[7988] Image.exe: Native' has exited with code -1073741819 (0xc0000005).