Skip to content

Why does not the name of lib file conform with Visual C public version number?

AlohaWorld edited this page Jun 21, 2017 · 2 revisions

Why we map the lib filename to Visual C++'s internal version instead of public version?

Will this confuse the newbie?


Answer from Qi:

Alexander Qi, [21.06.17 14:28]

pragma comment linker 是告诉 msvc 的

Nathan Cui, [21.06.17 14:32]

可以理解为只要包含了msvc.h,那么vc会自动链接xxx.lib文件,无需在工程项目属性中指定了对吗?

Alexander Qi, [21.06.17 14:32]


#if _MSC_VER == 1400 // Visual C++ 2005
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc8d.lib")
#    else
#        pragma comment(lib, "yagevc8.lib")
#    endif
#elif _MSC_VER == 1500 // Visual C++ 2008
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc9d.lib")
#    else
#        pragma comment(lib, "yagevc9.lib")
#    endif
#elif _MSC_VER == 1600 // Visual C++ 2010
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc10d.lib")
#    else
#        pragma comment(lib, "yagevc10.lib")
#    endif
#elif _MSC_VER == 1700 // Visual C++ 2012
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc11d.lib")
#    else
#        pragma comment(lib, "yagevc11.lib")
#    endif
#elif _MSC_VER == 1800 // Visual C++ 2013
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc12d.lib")
#    else
#        pragma comment(lib, "yagevc12.lib")
#    endif
#elif _MSC_VER == 1900 // Visual C++ 2015 RC
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc14d.lib")
#    else
#        pragma comment(lib, "yagevc14.lib")
#    endif
#elif _MSC_VER == 1910 // Visual C++ 2017
#    ifdef _DEBUG
#        pragma comment(lib, "yagevc15d.lib")
#    else
#        pragma comment(lib, "yagevc15.lib")