现在Win8已经发售了,但奇怪的是,没有听到新版Windows SDK的消息。
其次,Win8中集成了DirectX 11.1,而现在也没有新版DirectX SDK的消息。
搜索了一下后发现,原来它们已经集成到VS2012中了。
在VS2012中点击菜单栏“帮助”->“添加和移除帮助内容”,打开“Microsoft Help View 2.0 - Visual Studio 2012文档”——
需要等待一会儿,让文档列表下载完毕。注意选择“Windows Desktop App Development - 英语”,点击旁边的“添加”链接,它就是Win32 API和DirectX的文档。添加完所需的文档后,点击“更新”进行更新。
更新完成后,再次打开“Microsoft Help View 2.0 - Visual Studio 2012文档”,在将左侧面板切换到“目录”,可发现文档已经安装好了。例如Direct3D文档的位置是——
Windows Development (Windows) - 英语
Graphics and Gaming (Windows)
DirectX Graphics and Gaming (Windows)
DirectX 3D (Windows)
对于64位win8系统中默认安装的VS2012,Windows与DirectX的头文件默认是在“C:\Program Files (x86)\Windows Kits\8.0\Include”目录中。其中有三个子目录——
shared:非托管(um)与WinRT程序公用的头文件。
um:非托管程序专用的头文件。
WinRT:WinRT程序专用的头文件。
传统的Windows SDK程序是非托管的,头文件大多在um子目录中。
对于64位win8系统中默认安装的VS2012,Windows与DirectX的库文件默认是在“C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um”目录中。其中有三个子目录——
arm:ARM体系的库文件。
x64:x86体系的64位库文件。
x86:x86体系的32位库文件。
因托管程序(如WinRT)的库是以.Net程序集的方式管理的。所以这里只有非托管程序的“um”子目录。
对于64位win8系统中默认安装的VS2012,工具程序默认是在“C:\Program Files (x86)\Windows Kits\8.0\bin”目录中。其中有三个子目录——
arm:ARM体系的工具程序。
x64:x86体系的64位工具程序。
x86:x86体系的32位工具程序。
在VS2012中点击“工具”->“扩展和更新”,打开“扩展和更新”对话框。
在左侧树中依次点击“联机”->“示例库”,便可浏览线上示例列表。或者可以利用右上角的搜索框进行搜索。
找到所需的示例后,点击列表右侧的“下载”按钮,便可下载该示例。
示例下载下来后,我在VS2012的界面中找了半天也没找到打开它的地方。
尝试搜索*.sln文件,最后在“C:\Users\【用户】\AppData\Local\Microsoft\VisualStudio\11.0\Extensions”目录中找到了示例。每个示例都是在单独的随机名称文件夹中——
标签:
今天一整天都在折腾“error LNK2001: 无法解析的外部符号”,就在头疼不已的时候,总算是找到问题原因了:各个动态链接库的编译方式必须统一才行,要不然很容易对库函数的引用产生冲突。简单来说就是,如果使用的第三方函数库编译方式采用/MD,那么主工程也应该使用/MD。我使用了libevent,而主工程默认采用/MT,所以需要忽略一大堆的函数库,我还纳闷呢,怎么会这么奇怪!!今天总算是解决了长久以来的困惑了。
下面引用一篇文章的描述:[Z]VC运行库版本不同导致链接.LIB静态库时发生重复定义问题的一个案例分析和总结
再参考一篇:msvcprt.lib(MSVCP90.dll) : error LNK2005:已经在libcpmtd.lib(xmutex.obj) 中定义
Background
MSDN中对于在不同的配置下Link的LIB作了说明:
开关
|
对应的库
|
版本
|
/MD
|
MSVCRT.LIB
|
多线程DLL的Release版本
|
/MDd
|
MSVCRTD.LIB
|
多线程DLL的Debug版本
|
/MT
|
LIBCMT.LIB
|
多线程静态链接的Release版本
|
/MTd
|
LIBCMTD.LIB
|
多线程静态链接的Debug版本
|
/clr
|
MSVCMRT.LIB
|
托管代码和非托管代码混合
|
/clr:pure
|
MSVCURT.LIB
|
纯托管代码
|
C++ Standard Library:
开关
|
对应的库
|
版本
|
/MD
|
MSVCPRT.LIB
|
多线程DLL的Release版本
|
/MDd
|
MSVCPRTD.LIB
|
多线程DLL的Debug版本
|
/MT
|
LIBCPMT.LIB
|
多线程静态链接的Release版本
|
/MTd
|
LIBCPMTD.LIB
|
多线程静态链接的Debug版本
|
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: unsigned int __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const & __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "bool __cdecl std::operator<
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ios
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(int)" (?width@ios_base@std@@QAEHH@Z) already defined in antlr.lib(CharScanner.obj)
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static int __cdecl std::char_traits
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_streambuf
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char __thiscall std::basic_ios
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in antlr.lib(CharScanner.obj)
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBEHXZ) already defined in antlr.lib(CharScanner.obj)
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in antlr.lib(CharScanner.obj)
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::facet_Register(class std::locale::facet *)" (?facet_Register@facet@locale@std@@CAXPAV123@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(lconv.obj) : error LNK2005: _localeconv already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
1>LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMT.lib(_ctype.obj) : error LNK2005: _isprint already defined in MSVCRTD.lib(MSVCR80D.dll)
1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
1>LINK : warning LNK4098: defaultlib ‘MSVCRTD‘ conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib ‘LIBCMT‘ conflicts with use of other libs; use /NODEFAULTLIB:library
1>D:\home\doc\Visual Studio 2005\Projects\tst_antlr_3\Debug\tst_antlr_3.exe : fatal error LNK1169: one or more multiply defined symbols found
|