c++ - A segfault occurs before the main function is executed, and gdb cannot debug. It is probably related to the g++ compilation parameters.
仅有的幸福
仅有的幸福 2017-05-16 13:23:33
0
1
595

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.

仅有的幸福
仅有的幸福

reply all(1)
Peter_Zhu

There is a problem with the code I wrote to compile the static library.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!