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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sortoc

Pages: [1]
1
General / Re: Access violation with sf/std string
« on: April 25, 2012, 02:20:49 pm »
Thanks for your hint I didnĀ“t see a button for code tags so i thought they are not available.

2
General / Access violation with sf/std string
« on: April 24, 2012, 07:49:32 pm »
EDIT: Solved it, I was linking the false DLL files...

Hi i just started SFML yesterday. I wanted to start with the example code for displaying text but if i try to convert a unicode string to a single-byte string and clean up later i get a access violation at _lock. First someone told me it could be the default-font bug it happens only if i use the sf and std string.

Compiler: MSVC 2010
OS: Win-7 32 Bit

Source:
#include <Windows.h>
#include <string>
#include <SFML\Graphics.hpp>

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow )
{
        //sf::String sfStr("My Application");
        //std::string Str = sfStr.toAnsiString();

        sf::RenderWindow window(sf::VideoMode(600,400), "");
        //window.setTitle(Str);
       
        sf::Text text("First Time Test Text");

        while(window.isOpen())
        {
                sf::Event event;
                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                                window.close();
                }
                window.clear();
                window.draw(text);
                window.display();
        }
        return 0;
}

If I uncomment the 3 lines i get a access violation reading at 0x696c7064.

Callstack:
msvcr100d.dll!_lock(int locknum) Line 348
msvcr100d.dll!operator delete(void * pUserData) Line 45 + 0x7 Bytes
WinGame.exe!std::allocator<char>::deallocate(char * _Ptr, unsigned int __formal)  Line 182 + 0x9 Bytes   
WinGame.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy(bool _Built, unsigned int _Newsize)  Line 1998
WinGame.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >()  Line 755
WinGame.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int CmdShow)  Line 60 + 0x3c Bytes
WinGame.exe!__tmainCRTStartup()  Line 547 + 0x2c Bytes
WinGame.exe!WinMainCRTStartup()  Line 371



Pages: [1]
anything