0

Makefile

OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES))
TARGET = shacoin

first: all

%.o: %.cpp
        $(CC) -c $(CFLAGS) -o $@ $<  
                          
all: $(TARGET)

$(TARGET): $(OBJECTS)
        @echo $(TARGET)
        $(LINK) $(LIBS) $(OBJECTS) $(CFLAGS) $(LFLAGS) -o ../$(TARGET)

.PHONY: clean

clean:  
        rm -f $(OBJECTS) ../$(TARGET)  

At first, I run make and make quit error when run g++ -std=c++11 -c -g -Wall -rdynamic -I../include -o cryptography.o cryptography.cpp and then I solve it by upgrate openssl to 1.1.1m; but when I run make again, the similar problem show up like the picture.

Is it a error about makefile code or c++ file?

xing@xing-virtual-machine:~/shacoinFiles/block$ make
g++ -std=c++11 -c -g -Wall -rdynamic -I../include  -o blockChain.o blockChain.cpp  
g++ -std=c++11 -c -g -Wall -rdynamic -I../include  -o threadPool.o threadPool.cpp  
g++ -std=c++11 -c -g -Wall -rdynamic -I../include  -o cryptography.o cryptography.cpp  
g++ -std=c++11 -c -g -Wall -rdynamic -I../include  -o p2pNode.o p2pNode.cpp  
g++ -std=c++11 -c -g -Wall -rdynamic -I../include  -o main.o main.cpp  
shacoin
g++     ./blockChain.o  ./threadPool.o  ./cryptography.o  ./p2pNode.o  ./main.o   -g -Wall -rdynamic -I../include  -lcrypto -lssl -pthread -o ../shacoin
./cryptography.o: In function `ShaCoin::Cryptography::Base64Encode[abi:cxx11](void const*, int)':
/home/xing/shacoinFiles/block/cryptography.cpp:48: undefined reference to `EVP_ENCODE_CTX_new'
/home/xing/shacoinFiles/block/cryptography.cpp:74: undefined reference to `EVP_ENCODE_CTX_free'
./cryptography.o: In function `ShaCoin::Cryptography::Base64Decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void*, unsigned long, unsigned long*)':
/home/xing/shacoinFiles/block/cryptography.cpp:95: undefined reference to `EVP_ENCODE_CTX_new'
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target 'shacoin' failed
make: *** [shacoin] Error 1
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
Xing
  • 1

0 Answers0