Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

[SFML] Debug Assertion Failed

Ostatnio zmodyfikowano 2014-01-30 11:48
Autor Wiadomość
luki139
Temat założony przez niniejszego użytkownika
[SFML] Debug Assertion Failed
» 2014-01-29 23:08:00

C/C++
#include<SFML/Graphics.hpp>
#include<fstream>
#include<iostream>
#include<cctype>
#include<string>


int main()
{
   
    srand( time( NULL ) );
    std::ifstream openfile( "Mapa.txt" );
   
    sf::Texture tileTexture;
    sf::Sprite tiles;
   
    sf::Vector2i map[ 100 ][ 100 ];
    sf::Vector2i loadCounter = sf::Vector2i( 0, 0 );
   
   
    if( openfile.is_open() )
    {
        std::string tileLocation;
        openfile >> tileLocation;
        tileTexture.loadFromFile( tileLocation );
        tiles.setTexture( tileTexture );
        while( !openfile.eof() )
        {
            std::string str;
            openfile >> str;
            char x = str[ 0 ], y = str[ 2 ];
            //std::cout << "x: " << x << "y: " << y << std::endl;
            if( !isdigit( x ) || !isdigit( y ) )
                 map[ loadCounter.x ][ loadCounter.y ] = sf::Vector2i( - 1, - 1 );
            else
                 map[ loadCounter.x ][ loadCounter.y ] = sf::Vector2i( x - '0', y - '0' );
           
           
            if( openfile.peek() == '\n' )
            {
                loadCounter.x = 0;
                loadCounter.y++;
                std::cout << std::endl;
            }
            else
                 loadCounter.x++;
           
        }
        loadCounter.y++;
    }
   
    sf::RenderWindow Window( sf::VideoMode( 640, 480, 32 ), "Loading Tile Maps[Easy]" );
   
    while( Window.isOpen() )
    {
        sf::Event Event;
        while( Window.pollEvent( Event ) )
        {
            switch( Event.type )
            {
            case sf::Event::Closed:
                Window.close();
                break;
            }
        }
       
        Window.clear();
       
        for( int i = 0; i < loadCounter.x; i++ )
        {
            for( int j = 0; j < loadCounter.y; j++ )
            {
                if( map[ i ][ j ].x != - 1 && map[ i ][ j ].y != - 1 )
                {
                    tiles.setPosition( i * 32, j * 32 );
                    tiles.setTextureRect( sf::IntRect(( rand() % 2 ) * 32,( rand() % 2 ) * 32, 32, 32 ) );
                    Window.draw( tiles );
                }
            }
        }
       
        Window.display();
    }
   
    return 0;
}


Program się kompiluje, ale nie działa. W okienku wyskakuje :
Debug Assertion Failed!
Program: C\Windows32\MSVCP11OD.dll
File: e\programy\visualstudio\vs\include\xstring
Line 1662

Logi z debuggowania :

// throw -- terminate on thrown exception REPLACEABLE
#define _HAS_EXCEPTIONS 0
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <crtdbg.h>

_STD_BEGIN

#ifdef _DEBUG
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Debug_message(const wchar_t *message, const wchar_t *file, unsigned int line)
{ // report error and die
        if(::_CrtDbgReportW(_CRT_ASSERT, file, line, NULL, L"%s", message)==1)
        {
            ::_CrtDbgBreak();
        }
}
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Debug_message(const unsigned short *message, const unsigned short *file, unsigned int line)
{ // report error and die
        _Debug_message((wchar_t *) message, (wchar_t *) file, line);
}

#endif

_STD_END


'Kurs SFML.exe' (Win32): Loaded 'E:\C++\SFML\Kurs SFML\Debug\Kurs SFML.exe'. Symbols loaded.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'E:\C++\SFML\Kurs SFML\Debug\sfml-graphics-d-2.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'E:\C++\SFML\Kurs SFML\Debug\sfml-window-d-2.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'E:\C++\SFML\Kurs SFML\Debug\sfml-system-d-2.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atiglpxx.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atioglxx.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atiadlxy.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winnsi.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\aticfx32.dll'. Cannot find or open the PDB file.
'Kurs SFML.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atigktxx.dll'. Cannot find or open the PDB file.
The thread 0x310 has exited with code 0 (0x0).
Kurs SFML.exe has triggered a breakpoint.

Byłbym bardzo wdzięczny za wskazanie przyczyny błędu :D
P-103556
polkom21
» 2014-01-30 09:36:45
Przeleć debugiem i zobacz na czym Ci wywala.
P-103561
luki139
Temat założony przez niniejszego użytkownika
» 2014-01-30 11:06:17
::_CrtDbgBreak();
P-103564
DejaVu
» 2014-01-30 11:48:27
No ale taka jest właśnie idea tej funkcji - zatrzymać program i rzucić asercją... W każdym razie nie tu leży błąd. Skoro masz asercję i używasz Visual C++ to uruchom sobie panel 'call stack' i przeklikaj pokolei pozycje na liście, aż do napotkania kodu, który znasz (czyli kodu, który sam pisałeś).

PS.http://cpp0x.pl/kursy​/Kurs-SFML-2-x-C++/460

Polecam Ci zacząć od powyższego kursu SFML. Jak już skonfigurujesz sobie poprawnie bibliotekę i przykład poprawnie zadziała, to potem korzystaj sobie z czego chcesz, ale przynajmniej będziesz miał gwarancję, że instalację biblioteki przeprowadziłeś prawidłowo.
P-103568
« 1 »
  Strona 1 z 1