gpt4 book ai didi

c++ - 仅静态链接 boost 库 G++

转载 作者:IT王子 更新时间:2023-10-29 01:10:13 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Can I mix static and shared-object libraries when linking?

我想编译我的应用程序,仅静态链接 boost_system 库。其他(glibc 等)应该动态链接。我该怎么做?

我的动态编译命令:

g++  -o newserver  server.cpp ... -lboost_system -std=c++0x

静态编译命令:

g++ -static  -o newserver  server.cpp ... -pthread -lboost_system -std=c++0x

但是这个命令静态链接所有!应用重量增加了 2mb!

你能告诉我什么命令只静态编译 boost lib 吗?

谢谢!

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com