Makefile Error: undefined reference to `zmq_connect'

Viewed 14

I have a C++ project that uses the zmq library. My project has the following files in the root folder:

main.cpp
app1.cpp app1.h
app2.cpp app2.h

I was previously creating the executable by running the following command: g++ main.cpp app1.cpp app2.cpp -lzmq -o output

Now I want to create a Makefile for this project. My Makefile contains the following:

CFLAGS = -lzmq
all: main.o app1.o src/app2.o
    g++ -o main $(CFLAGS) main.o app1.o app2.o
clean:
    $(RM) main

When I run make, it gives me undefined references to the zmq function, which implies that it did not include the zmq library. How can I solve this issue?

P.S. I have not made a Makefile before and I created this one based on some tutorial articles.

0 Answers
Related