【发布时间】:2023-03-19 01:06:01
【问题描述】:
我想为 linux 上的 c++ 程序创建一个动态库。 在 c++ 程序/系统中,我使用 libconfig++ 库、libpqxx 库、一些 boost 和 c++11。
我的步骤: 1)
g++ -Wall -I/usr/local/include/ -std=c++0x -lconfig++ -Wall -lpqxx -lpq -fPIC -c ../SourceFiles/DBHandler.cpp ../SourceFiles/ParamServer.cpp ../SourceFiles/Functions.cpp
2)
g++ -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 *.o
3)
ln -sf libctest.so.1.0 libctest.so.1
4)
ln -sf libctest.so.1.0 libctest.so
5) 编译
g++ -Wall -I/path/to/include-files -L/path/to/libraries program.cpp -I/usr/local/include/ -std=c++0x -lconfig++ -lpqxx -lpq -lctest -o prog
执行上述命令后:
/usr/bin/ld: cannot find -lctest
collect2: ld returned 1 exit status
我做错了什么?
这里是参考: enter link description here
【问题讨论】:
标签: c++ boost c++11 dynamic-linking dynamic-library