Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.0 RC and loadFromFile System.AccessViolationException  (Read 2113 times)

0 Members and 1 Guest are viewing this topic.

dardyfella

  • Newbie
  • *
  • Posts: 3
    • View Profile
I followed the tutorial to get SFML to work with Visual C++ 2010 Express and I keep getting an unhandled System.AccessViolationException whenever I try to load an image from file. The offending code is below. stdafx.h contains the include lines for System.hpp, Window.hpp and Graphics.hpp.

Code: [Select]
#include "stdafx.h"
int main()
{
sf::Image test;
test.loadFromFile("E:\\test.bmp");
        return 0;
}

When the exception occurs Visual C++ opens up memcpy.asm with the following assembly indicated:
Code: [Select]
rep     movsd           ;N - move all of our dwords

Other SFML 2.0 example code compiles and runs just fine (code from here: http://www.sfml-dev.org/tutorials/2.0/start-vc.php runs without any problems). I'm running a 64-bit copy of Windows 7 but I'm compiling for x86/Win32 with dynamic libraries. I understand this release is meant to be a release candidate but it does seem like a bit of a shop-stopping issue.

Please excuse me if I should have posted this to a different forum.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC and loadFromFile System.AccessViolationException
« Reply #1 on: May 08, 2012, 03:28:43 pm »
Do you get more detailed information if you run the debugger?
Laurent Gomila - SFML developer

dardyfella

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.0 RC and loadFromFile System.AccessViolationException
« Reply #2 on: May 08, 2012, 04:25:51 pm »
I'm not entirely sure what you mean by running the Visual C++ debugger. I'm building with debugging enabled if that's what you mean.

Anywho, I removed all the SFML .dll files from my project folders and replaced them with the SFML debug .dlls and I changed the Additional Dependencies to point to the SFML debug .lib files and loadFromFile doesn't throw an System.AccessViolationException any more.

At first I thought I might have gotten a bad download but I downloaded SFML-2.0-rc-windows-32-vc2010.zip again and the MD5 sums matched.

If you're willing to run me through how to get the Visual C++ debugger to run or just provide some information I'd be willing to get some more information for you.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC and loadFromFile System.AccessViolationException
« Reply #3 on: May 08, 2012, 04:31:06 pm »
Quote
Anywho, I removed all the SFML .dll files from my project folders and replaced them with the SFML debug .dlls and I changed the Additional Dependencies to point to the SFML debug .lib files and loadFromFile doesn't throw an System.AccessViolationException any more.
So you were mixing debug and release configurations? This must be avoided, as stated in the tutorial.

Quote
If you're willing to run me through how to get the Visual C++ debugger to run
Press F5 (or the little green arrow in the toolbar) to run the app with the debugger.
Laurent Gomila - SFML developer

dardyfella

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.0 RC and loadFromFile System.AccessViolationException
« Reply #4 on: May 08, 2012, 05:36:39 pm »
Quote
Quote
Anywho, I removed all the SFML .dll files from my project folders and replaced them with the SFML debug .dlls and I changed the Additional Dependencies to point to the SFML debug .lib files and loadFromFile doesn't throw an System.AccessViolationException any more.
So you were mixing debug and release configurations? This must be avoided, as stated in the tutorial.
It appears you are completely correct. I didn't realise that the selected Solution Configuration in Visual C++ has an impact on which .dll and .lib files to use. Thanks

 

anything