0
I’m trying to use wxWidgets to do a college project and I ended up trying to use Makefile out of curiosity, below the Makefile I’m using as an example for the project.
Makefile
CPP_FILES := $(wildcard src/*.cpp)
OBJ_FILES := $(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))
LD_FLAGS := -lm
CPP_FLAGS := -Wall -Wextra
Crypto: $(OBJ_FILES)
g++ -o $@ $^ $(LD_FLAGS)
obj/%.o: src/%.cpp src/%.h
g++ $(CPP_FLAGS) -c -o $@ $<
clean:
rm -f $(OBJ_FILES) *.o
I tried to adapt it to use wxWidgets flags and libs but when I run Makefile it gives me some Linker errors...
Makefile wxWidgets
CPP_FILES := $(wildcard src/*.cpp)
OBJ_FILES := $(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))
# wx-config --libs
WX_LIBS = $(shell wx-config --libs)
# wx-config --cxxflags
WX_CXXFLAGS = $(shell wx-config --cxxflags)
LD_FLAGS := -lm
CPP_FLAGS := -Wall -Wextra
Crypto: $(OBJ_FILES)
g++ -o $@ $^ $(LD_FLAGS)
obj/%.o: src/%.cpp src/%.h
g++ $(CPP_FLAGS) $(WX_CXXFLAGS) $(WX_LIBS) -o $@ $<
clean:
rm -f $(OBJ_FILES) *.o
One of Linker errors that is generated
mainWindow.cpp:(.text._ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EclEPS3_RS4_[_ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EclEPS3_RS4_]+0x8c): undefined reference to `wxTrap()'
collect2: error: ld returned 1 exit status
What can I modify in this Makefile? I’m still studying the workings of Makefile and am trying to apply it using wxWidgets