简体   繁体   English

如何从我的 Makefile 链接 Allegro 5?

[英]How do I link Allegro 5 from my Makefile?

I need to link the Allegro Game Development Library from my Makefile .我需要从我的Makefile链接 Allegro 游戏开发库。 When I do this, the compiler returns:当我这样做时,编译器返回:

Undefinied Reference < Function Name >.

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:在尝试将编译行嵌入到 Makefile 之前,请确保您了解如何在命令行中执行此操作,更重要的是,请确保它可以正常工作:

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

Then, a simple Makefile to compile hello.cpp could be:然后,一个简单的Makefile编译hello.cpp可以是:

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM