如何从我的Makefile中链接Allegro 5? [英] How do I link Allegro 5 from my Makefile?

查看:108
本文介绍了如何从我的Makefile中链接Allegro 5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从我的 Makefile 链接Allegro游戏开发库.当我这样做时,编译器将返回:

I need to link the Allegro Game Development Library from my Makefile. When I do this, the compiler returns:

Undefinied Reference < Function Name >.

推荐答案

在尝试将编译行嵌入到Makefile中之前,请确保您了解如何在命令行中进行操作,更重要的是,请确保它可以工作: /p>

Before trying to embed the compilation line into the Makefile, make sure you understand how to do it the command line, and more important, make sure it works:

g++ hello.cpp -o hello -I/usr/include/allegro5 -L/usr/lib -lallegro

然后,一个简单的Makefile即可编译 hello.cpp 可能是:

Then, a simple Makefile to compile hello.cpp could be:

CXX=g++
CFLAGS=
LDFLAGS=-L/usr/lib -lallegro
INCLUDE=-I. -I/usr/include/allegro5

OBJS=hello.o
OUT=hello

all: hello_rule

clean:
        rm -rf *.o hello

hello_rule: $(OBJS)
        $(CXX) $(OBJS) -o $(OUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS)

这篇关于如何从我的Makefile中链接Allegro 5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆