ldd -r cpp_ctp.so
linux-vdso.so.1 (0x00007fffe9588000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f77651a6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7764f8e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7764b9d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f77647ff000)
/lib64/ld-linux-x86-64.so.2 (0x00007f77657bb000)
undefined symbol: pthread_create (./cpp_ctp.so)
undefined symbol: _ZN15CThostFtdcMdApi15CreateFtdcMdApiEPKcbb (./cpp_ctp.so)
undefined symbol: _ZN19CThostFtdcTraderApi13GetApiVersionEv (./cpp_ctp.so)
undefined symbol: _ZN15CThostFtdcMdApi13GetApiVersionEv (./cpp_ctp.so)
undefined symbol: _ZN19CThostFtdcTraderApi19CreateFtdcTraderApiEPKc (./cpp_ctp.so)
下面的命令行可以正常工作。
g++ ./server/cpp_ctp.cpp -shared -fPIC -I ./server/ -I ./server/ctp_api_6.3.15_20190220/ -L ./server/ctp_api_6.3.15_20190220/linux64/ -lthostmduserapi_se -lthosttraderapi_se -lpthread -o cpp_ctp.soldd -r cpp_ctp.so
linux-vdso.so.1 (0x00007ffcc65dd000)
libthostmduserapi_se.so => ./server/ctp_api_6.3.15_20190220/linux64/libthostmduserapi_se.so (0x00007ff2252a7000)
libthosttraderapi_se.so => ./server/ctp_api_6.3.15_20190220/linux64/libthosttraderapi_se.so (0x00007ff22493b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff22471c000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff224393000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff22417b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff223d8a000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff223b82000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff22397e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff2235e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff225e1d000)