如何链接到动态提升库?

2021-12-24 00:00:00 c++ boost

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

I compiled boost lib and got these.

//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)

In Visual Studio, I have written a test app using the boost thread library. Based on code generation settings it asks for these four libs only (like multithreading debug, multithreading, multithreading debug dll, and multithreading 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?

Now my question is how can I link my app to the other 2 libs so that it uses the dlls?

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 代表什么?

Question 2. What does the g, s stands for?

推荐答案

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

You can force Boost to use the DLLs by defining BOOST_ALL_DYN_LINK - either in your C++ preprocessor settings or by a #define in your stdafx.h pre-compiled header, e.g.:

#define BOOST_ALL_DYN_LINK

相关文章