伙计们我想在Ubuntu 11.04上安装allegro 5库。我遵循的教程is这个。 现在我在第一次尝试安装库时遇到了一些错误,但我可以克服它们并正确安装库。问题是,当我尝试运行我的示例代码时
#include <allegro5/allegro.h>
int main(int argc, char *argv[])
{
allegro_init();
install_keyboard();
set_gfx_mode(GFX_AUTODETECT, 640,480,0,0);
readkey();
return 0;
}
END_OF_MAIN()
我收到错误,如
ajinkya@ajinkya-8I945GZME-RH:~/random$ g++ example.cpp -o example -lalleg
example.cpp: In function ‘int main(int, char**)’:
example.cpp:7:15: error: ‘allegro_init’ was not declared in this scope
example.cpp:9:19: error: ‘install_keyboard’ was not declared in this scope
example.cpp:11:15: error: ‘GFX_AUTODETECT’ was not declared in this scope
example.cpp:11:42: error: ‘set_gfx_mode’ was not declared in this scope
example.cpp:13:10: error: ‘readkey’ was not declared in this scope
example.cpp: At global scope:
example.cpp:18:13: error: expected constructor, destructor, or type conversion at end of input
我在/usr/include/allegro5
中拥有所有主要的头文件。
答案 0 :(得分:2)
您是否检查过这些方法实际存在于头文件中?
您似乎正在使用Allegro 4 API而不是Allegro 5: 见http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays