简体   繁体   中英

How do I link Allegro 5 from my Makefile?

I need to link the Allegro Game Development Library from my Makefile . 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:

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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