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

Author Topic: Access violation with sf::Text in SFML2.0  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

TrapAlice

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access violation with sf::Text in SFML2.0
« on: January 31, 2012, 08:11:24 pm »
I keep getting the error 0xC0000005: Access violation reading location 0xcccccccc.
Minimal example:
Code: [Select]
#include <SFML/Graphics.hpp>

int main(){
  sf::Font font;
  font.LoadFromFile("lucon.ttf");
  sf::Text text("Test", font, 30);
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Laurent Gomila - SFML developer

TrapAlice

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access violation with sf::Text in SFML2.0
« Reply #2 on: January 31, 2012, 09:01:58 pm »
Callstack
Quote
sfml-system-d-2.dll!std::_Char_traits<unsigned int,long>::assign(unsigned int & _Left, const unsigned int & _Right)  Line 215 + 0x6 bytes   C++
    sfml-system-d-2.dll!std::_Char_traits<unsigned int,long>::copy(unsigned int * _First1, const unsigned int * _First2, unsigned int _Count)  Line 167 + 0xd bytes   C++
    sfml-system-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::assign(const std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> > & _Right, unsigned int _Roff, unsigned int _Count)  Line 903 + 0x21 bytes   C++
    sfml-system-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >(const std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> > & _Right)  Line 546   C++
    sfml-system-d-2.dll!sf::String::String(const sf::String & copy)  Line 132   C++
    sfml-graphics-d-2.dll!sf::Text::Text(const sf::String & string, const sf::Font & font, unsigned int characterSize)  Line 59 + 0x74 bytes   C++
    MoonEnginev2.exe!moon::Draw::DrawText(moon::Window * pTarget, std::basic_string<char,std::char_traits<char>,std::allocator<char> > pText, int pX, int pY, moon::Colour pCol)  Line 33 + 0x61 bytes   C++


Running on Windows 7 with a Nvidia graphics card, using the latest revision off github.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access violation with sf::Text in SFML2.0
« Reply #3 on: January 31, 2012, 11:03:35 pm »
Which CMake options did you use to compile SFML?
Laurent Gomila - SFML developer

TrapAlice

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access violation with sf::Text in SFML2.0
« Reply #4 on: February 01, 2012, 10:19:55 pm »
What I have in CMake is:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access violation with sf::Text in SFML2.0
« Reply #5 on: February 02, 2012, 07:52:38 am »
Hmm... your screenshot shows "Release" but the DLL name (sfml-system-d-2.dll) implies Debug.
Laurent Gomila - SFML developer

TrapAlice

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access violation with sf::Text in SFML2.0
« Reply #6 on: February 02, 2012, 11:45:02 am »
Tried changing it from Release to Debug, still has the same problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access violation with sf::Text in SFML2.0
« Reply #7 on: February 02, 2012, 11:54:33 am »
My point was that your CMake settings don't match the DLL that causes the error. So make sure that you're really using the DLLs that you recompiled, and not an older version that would be lost somewhere on your hard drive.

Even your callstack doesn't match the code that you're showing.

Please provide consistent information, otherwise we won't be able to help you.
Laurent Gomila - SFML developer

TrapAlice

  • Newbie
  • *
  • Posts: 5
    • View Profile
Access violation with sf::Text in SFML2.0
« Reply #8 on: February 02, 2012, 02:01:51 pm »
It was a complete screw up I've made, I was including the release libs but using the debug dlls..

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access violation with sf::Text in SFML2.0
« Reply #9 on: February 02, 2012, 02:04:26 pm »
Quote
It was a complete screw up I've made, I was including the release libs but using the debug dlls..

It is nearly impossible to mix the debug and release DLLs, they have a different name. The only way to screw up is to add/remove the "-d" suffix yourself.
Laurent Gomila - SFML developer

 

anything