gpt4 book ai didi

c++ - 如何链接到动态 boost 库?

转载 作者:IT老高 更新时间:2023-10-28 12:44:49 26 4
gpt4 key购买 nike

我编译了 boost lib 并得到了这些。

//Shared/dynamic link libraries

24/03/2010 11:25 PM 53,248 boost_thread-vc80-mt-1_42.dll
24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt-1_42.lib
24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt.lib

24/03/2010 11:25 PM 73,728 boost_thread-vc80-mt-gd-1_42.dll
24/03/2010 11:25 PM 17,214 boost_thread-vc80-mt-gd-1_42.lib
24/03/2010 11:25 PM 17,214 boost_thread-vc80-mt-gd.lib

// Static libs... does not need any dlls

24/03/2010 11:25 PM 381,716 libboost_thread-vc80-mt-1_42.lib
24/03/2010 11:25 PM 381,716 libboost_thread-vc80-mt.lib

24/03/2010 11:25 PM 999,552 libboost_thread-vc80-mt-gd-1_42.lib
24/03/2010 11:25 PM 999,552 libboost_thread-vc80-mt-gd.lib

24/03/2010 11:25 PM 421,050 libboost_thread-vc80-mt-s-1_42.lib
24/03/2010 11:25 PM 421,050 libboost_thread-vc80-mt-s.lib

24/03/2010 11:25 PM 1,015,688 libboost_thread-vc80-mt-sgd-1_42.lib
24/03/2010 11:25 PM 1,015,688 libboost_thread-vc80-mt-sgd.lib

在 Visual Studio 中,我使用 boost 线程库编写了一个测试应用程序。根据代码生成设置,它只要求这四个库(如多线程调试、多线程、多线程调试 dll 和多线程 dll)

24/03/2010  11:25 PM           381,716 libboost_thread-vc80-mt-1_42.lib
24/03/2010 11:25 PM 381,716 libboost_thread-vc80-mt.lib

24/03/2010 11:25 PM 999,552 libboost_thread-vc80-mt-gd-1_42.lib
24/03/2010 11:25 PM 999,552 libboost_thread-vc80-mt-gd.lib

24/03/2010 11:25 PM 421,050 libboost_thread-vc80-mt-s-1_42.lib
24/03/2010 11:25 PM 421,050 libboost_thread-vc80-mt-s.lib

24/03/2010 11:25 PM 1,015,688 libboost_thread-vc80-mt-sgd-1_42.lib
24/03/2010 11:25 PM 1,015,688 libboost_thread-vc80-mt-sgd.lib

现在我的问题是如何将我的应用链接到其他 2 个库,以便它使用 dll?

24/03/2010  11:25 PM            53,248 boost_thread-vc80-mt-1_42.dll
24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt-1_42.lib
24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt.lib

24/03/2010 11:25 PM 73,728 boost_thread-vc80-mt-gd-1_42.dll
24/03/2010 11:25 PM 17,214 boost_thread-vc80-mt-gd-1_42.lib
24/03/2010 11:25 PM 17,214 boost_thread-vc80-mt-gd.lib

问题 2. g, s 代表什么?

最佳答案

您可以通过定义 BOOST_ALL_DYN_LINK 来强制 Boost 使用 DLL - 在 C++ 预处理器设置中或通过 stdafx.h 中的 #define code> 预编译头文件,例如:

#define BOOST_ALL_DYN_LINK

关于c++ - 如何链接到动态 boost 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2520234/

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