简体   繁体   中英

visual studio 2013 options

如果.lib文件用于静态链接,而.dll文件用于动态链接,为什么要在C / C ++->代码生成->运行时库选项中指定,则在构建显式静态库时(即,创建.dll时)选择多线程或多线程DLL。 lib)还是在构建项目并链接到.lib库时?

Visual Studio allows you to specify how the CRT is going to be integrated into your project under C/C++->Code Generation->Runtime Library . This project setting controls how C/C++ routines used explicitly or internally (eg exception functions or STL routines) are going to be linked to your project.

You can create a static library which uses the CRT dynamically or statically by specifying the /MT or /MD flag during compilation.

Regarding advantages/disadvantages I'm linking this answer which features a pretty good list of points to keep in mind.

One last thing to notice: if your project is going to use multiple static libraries (including your .lib file), you should make sure that this CRT option matches during the linking phase otherwise you might encounter the (in)famous LNK4098 error .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM