在 ubuntu 上编译 Allegro 5.0 库:“未定义的引用...”
我是 Allegro、Ubuntu 和 C++ 的新手...提前抱歉...
我刚刚安装了 Allegro 4。来自 ubuntu 软件管理器的一些东西。然后,我按照此页面的说明安装 Allegro 5我认为我的库链接不正确,但我不知道如何手动更改它。
我的代码:
#include <allegro.h> //the allegro 4 header?
#include <allegro/allegro5.h> //the allegro 5 header?
int main(){
allegro_init();
}
END_OF_MAIN()
我的编译行:
g++ allegro_test.cpp -o output.out `pkg-config --libs allegro5.0`
我的输出:
allegro_test.cpp (.text+0x2a) undefined refrence to '_install_allegro_check_version'
我假设它类似于
I'm new to Allegro, Ubuntu, and C++ ... sorry in advance...
I just installed Allegro 4. Something from the ubuntu software manager. I then followed the directions of this page to install Allegro 5. I don't think my libs are linked correctly, but I don't exactly know how to manually change that.
My code:
#include <allegro.h> //the allegro 4 header?
#include <allegro/allegro5.h> //the allegro 5 header?
int main(){
allegro_init();
}
END_OF_MAIN()
My compile line:
g++ allegro_test.cpp -o output.out `pkg-config --libs allegro5.0`
My output:
allegro_test.cpp (.text+0x2a) undefined refrence to '_install_allegro_check_version'
I assume it is similar to this question, but I cannot figure out how to get the library linked. I'd like to have it know automatically.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道现在回答这个问题已经太晚了,但可能有人在某个地方寻求答案。
头文件错误;它应该是这样的:-
I know it's too late to answer this, but there might be someone somewhere seeking for an answer.
the header file is wrong; it should be like this:-
从您链接的问题来看:
但是,您发布的源代码是 Allegro 4。Allegro 5 不向后兼容。 A5 等效项为:
From the question you linked:
However, the source code you've posted is Allegro 4. Allegro 5 is not backward compatible. The A5 equivalent is: