I would like to compile my program but I have some problems to do so. My program is composed of a main function, written in C. The other files are either .h or .cpp files that I haven't written. I have a make file but unfortunately I cannot compile my program. This is the "architecture" of the files :
a.h only contains definitions of constant.
b.h and b.cpp. b.cpp includes a.h
c.h and d.cpp. c.h contains the signatures of d.cpp's methods. d.cpp includes a.h, b.h and c.h.
The last file is main.c which include c.h.
The makefile I used is the following one :
CXX = g++
CXXFLAGS = -Wall -ansi -g
CC = gcc
CCFLAGS = -g
OBJS = main.o a.o b.o c.o
exec : $(OBJS)
$(CXX) -o $@ $(OBJS)
c.o: d.cpp b.h a.h
$(CXX) -c $(CXXFLAGS) $<
a.o: a.h
$(CXX) -c $(CXXFLAGS) $<
b.o: b.cpp a.h
$(CXX) -c $(CXXFLAGS) $<
%.o : %.cpp
$(CXX) -c $(CXXFLAGS) $<
%.o : %.c
$(CC) -c $(CCFLAGS) $<
Can someone me where I'm wrong ? Furthermore, how can I modify the makefile such that I can put a,b,c and d files in a subfolder without causing any problem ?
Thank you !
EDIT : This is the error I get :
g++ -o tester main.o a.o b.o c.o
Undefined symbols for architecture x86_64:
"_crypto_aead_encrypt", 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: *** [tester] Error 1
The function is defined in declared in c.h and defined in d.cpp
extern "C"properly? - MikeCAT