我有一个名为zone.c的程序,它使用allegro5库。
我有一个makefile,它只包含这两行。
zone: zone.c
gcc zone.c -o zone $(pkg-config --cflags --libs allegro-5.0 allegro_primitives-5.0)当我输入"make“时,我会看到以下这些错误:
/tmp/ccyCx3Hy.o:函数main': zone.c:(.text+0x14): undefined reference toal_install_system‘zone.c:(.text+0x23):未定义的对al_create_display' zone.c:(.text+0x3b): undefined reference toal_map_rgb’zone.c:(.text+0x70)的引用:(.text+0x70):未定义的对al_clear_to_color' zone.c:(.text+0x84): undefined reference toal_map_rgb‘zone.c的引用:(.text+0xd1):未定义的对al_draw_filled_circle' zone.c:(.text+0xe5): undefined reference toal_map_rgb’zone.c的引用:(.text+0x132):未定义的对al_draw_filled_circle' zone.c:(.text+0x137): undefined reference toal_flip_display‘zone.c的引用:(.text+0x14f):未定义的对al_rest' zone.c:(.text+0x15b): undefined reference toal_destroy_display’zone.c:错误的引用:ld返回一个退出状态:*区域错误1
但是,如果我只复制"gcc zone.c -o zone $(pkg-config -c阻击-libs allero-5.0 allero-原语-5.0)“行并手动运行它,那么它编译就会很好,程序就能工作了。
如果我使用类似的makefile来编译不使用allegro5的程序,那么就可以工作了。
有人知道发生了什么事吗?
发布于 2014-03-17 15:54:21
如果您想要在您的规则中使用文字$,则必须通过编写$$来避免它:
zone: zone.c
gcc zone.c -o zone $$(pkg-config --cflags --libs allegro-5.0 allegro_primitives-5.0)https://stackoverflow.com/questions/22458862
复制相似问题