How do I link Allegro 5 from my Makefile?

萝らか妹 提交于 2019-12-24 03:35:23

问题


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

Undefinied Reference < Function Name >.

回答1:


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

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)


来源:https://stackoverflow.com/questions/6560760/how-do-i-link-allegro-5-from-my-makefile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!