我试图在我的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
奇怪的是,在发布模式下,它似乎工作正常(窗口出现一段时间然后关闭自己,在调试模式下,屏幕显示但它有蓝色代替,最后,它确实崩溃)
答案 0 :(得分:0)
根据问题的评论,我想问题来自于你使用CodeBlocks提供的MinGW 4.7.1,而你的Allegro二进制文件是为MinGW 4.7.0编译的。
根据指向this similar question的this forum thread,用于Allegro和程序的编译器版本必须相同。因此,您可以: