Try to use c++ to package openssl, first write a static library libtest.a. Depends on -lssl -lcrytpo -lpthread.
Directory Structure:
There are two test files: client.cpp, server.cpp
The commands used to compile the executable program are as follows:
g++ -g -o2 -fpic client.cpp -I../include -L ../lib -ltest -shared -u -lssl -lcrypto -lpthread -o client
Compilation successful;
Execution error, gdb debugging found that it crashed before the main function started.
Supplement: Comment all the main function codes, and the above compilation will not work. Remove the -shared parameter when compiling, and the program will end normally.
天蓬老师2017-05-16 13:25:33
There is a problem with the code I wrote to compile the static library.