1

我在从https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays on CodeBlocks 编译代码时遇到问题:

#define ALLEGRO_STATICLINK
#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;
}

编译器为每个“al_”函数提供错误“未定义的引用”。我找到了“解决方案”(Ubuntu 中的 Allegro: undefined reference to `al_install_system' & Compiling C++ code with allegro 5 and g++),但现在编译器给出了错误g++.exe: error: 'pkg-config: No such file or directory。我该如何解决?

//编辑:CodeBlocks 生成的构建命令: g++.exe -o bin\Debug\Obvi.exe obj\Debug\Main.o 'pkg-config --libs allegro-5.0.10' ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\liballegro-5.0.10-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libvorbisfile-1.3.2-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libvorbis-1.3.2-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libdumb-0.9.3-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libFLAC-1.2.1-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libfreetype-2.4.8-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libogg-1.2.1-static-mt.a ..\..\libs\allegro-5.0.10-mingw-4.7.1-tdm\lib\libzlib-1.2.5-static-mt.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libgdiplus.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libuuid.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libkernel32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libwinmm.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libpsapi.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libopengl32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libglu32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libuser32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libcomdlg32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libgdi32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libshell32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libole32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libadvapi32.a ..\..\..\TDM-GCC-64\x86_64-w64-mingw32\lib\libws2_32.a

4

0 回答 0