0

我试图在我的 CODE::BLOCKS sftwr 上编译和运行以下代码,但由于 dll "libstdc++6.dll" 的一些问题,它永远无法正常运行

我将代码列表和调试模式下的错误日志留给您 (f8)

#include <stdio.h>
#include <allegro5/allegro.h> 

int main(int argc, char **argv){ 
    ALLEGRO_DISPLAY *display = NULL;
    if(!al_init()) {
        fprintf(stderr, "failed to initialize allegro!\n");
        return -1;
    }
    display = al_create_display(640, 480);
    if(!display) {
        fprintf(stderr, "failed to create display!\n");
        return -1;
    }
    al_clear_to_color(al_map_rgb(0,0,0));
    al_flip_display();
    al_rest(10.0);
    al_destroy_display(display);
    return 0;
}   

调试输出:

Building to ensure sources are up-to-date
Selecting target: 
Debug
Adding source dir: c:\telechar\Codeblocks\Mesprojets\MonProjet\
Adding source dir: c:\telechar\Codeblocks\Mesprojets\MonProjet\
Adding file: c:\telechar\Codeblocks\Mesprojets\MonProjet\bin\Debug\MonProjet.exe
Changing directory to: c:/telechar/Codeblocks/Mesprojets/MonProjet/.
Set variable: PATH=.;C:\Telechar\CodeBlocks\MinGW\bin;C:\Telechar\CodeBlocks\MinGW;
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files (x86)\Common  Files\Ulead Systems\MPEG;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared
Starting debugger: C:\Telechar\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args c:/telechar/Codeblocks/Mesprojets/MonProjet/bin/Debug/MonProjet.exe 
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.5
Child process PID: 5536
Error while reading shared library symbols for c:\telechar\Codeblocks\Mesprojets\MonProjet\libstdc++-6.dll:
...
Error while reading shared library symbols for c:\telechar\Codeblocks\Mesprojets\MonProjet\libstdc++-6.dll:
Program received signal SIGSEGV, Segmentation fault.
In al_destroy_display () (c:\telechar\Codeblocks\Mesprojets\MonProjet\allegro-5.0.10-md.dll)
Continuing...
Program received signal SIGSEGV, Segmentation fault.
In al_destroy_display () (c:\telechar\Codeblocks\Mesprojets\MonProjet\allegro-5.0.10-md.dll)
Continuing...
[Inferior 1 (process 5536) exited with code 030000000005]
Debugger finished with status 0

奇怪的是,在发布模式下,它似乎工作正常(一个窗口出现一段时间然后自行关闭,在调试模式下,屏幕显示但它有一个蓝色,最后,它确实崩溃了)

4

1 回答 1

0

根据问题的评论,我想问题出在您使用 CodeBlocks 提供的 MinGW 4.7.1,而您的 Allegro 二进制文件是为 MinGW 4.7.0 编译的。

根据指向此论坛主题的类似问题,用于 Allegro 和您的程序的编译器版本必须相同。因此,您可以:

  • 下载为 MinGW 4.7.1 编译的 Allegro 版本,
  • 或者自己编译 Allegro,使用 MinGW 4.7.1,
  • 或使用 MinGW 4.7.0 代替 CodeBlocks 提供的版本。
于 2013-10-02T14:03:49.293 回答