Linker command failed

I'm trying to compile my .cpp files with this Make file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

SOURCE_FILES = $(call rwildcard, , *.cpp)
OBJECT_FILES = $(SOURCE_FILES:.cpp=.o)

all: build build/main clean_objects

build:
	mkdir -p build

build/main: $(OBJECT_FILES)
	g++ -g $^ -std=c++11 -o $@

%.o: %.cpp
	g++ -g -std=c++11 -c $^ -o $@

clean_objects: $(OBJECT_FILES)
	rm $^


The directory tree looks like that:

.
├── Makefile
├── build
├── include
│   └── KingSort
│   └── KingSort.hpp
└── src
├── KingSort
│   ├── KingSort.cpp
│   └── KingSort.o
└── app
├── main.cpp
└── main.o



And I'm getting this error here:


Undefined symbols for architecture x86_64:
  "KingSort::KingSort()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/main] Error 1



Any ideas on what is this about? Thanks!
Last edited on
Found it, I declared a constructor signature but didn't implement it. Thanks!
Topic archived. No new replies allowed.