Reputation: 27
I'm trying to build a c++ Wt program. However, my makefile does not work.
I have the following:
CXX=g++
LDFLAGS=-lwt -lwthttp
CXXFLAGS=-Wall
SOURCES=main.cpp test.cpp
OBJ=$(SOURCES:.cpp=.o)
EXE=test
all: $(SOURCES) $(EXE)
$(EXE): $(OBJ)
$(CXX) $(LDFLAGS) $(OBJ) -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) $< -o $@
But this gives me the error that it is missing references to the Wt classes during compile-time.
Upvotes: 0
Views: 722
Reputation: 409136
The GNU linker resolves dependencies in a specific order, which means you have to put libraries last when linking, So change
$(CXX) $(LDFLAGS) $(OBJ) -o $@
to
$(CXX) $(OBJ) $(LDFLAGS) -o $@
Upvotes: 2