I am getting the following output from my makefile. My main goal is to compile everything in a directory. I expect to have many more cpp files in future. Any tips or advice is greatly appreciated!
Output:
g++ `pkg-config --libs --cflags opencv libexif` main.cpp -o main.o
g++ `pkg-config --libs --cflags opencv libexif` Image.cpp -o Image.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Image.o] Error 1
Current list of files: main.cpp, Image.h, Image.cpp
Here's the makefile:
CC=g++
CFLAGS= `pkg-config --libs --cflags opencv libexif`
LDFLAGS= `pkg-config --libs --cflags opencv libexif`
SOURCES=main.cpp Image.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=CvHelloWorld
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm *.o