C++ 我在哪里可以找到“winmm.lib”(我使用的是 Visual Studio 2012)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26762013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where can I find 'winmm.lib' (I'm using Visual Studio 2012)
提问by Se Cheol Park
My OS is 64Bit Windows 7.
I wanted to build the DirectX Sample in
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D10\Tutorials\Tutorial02.
but when I build error occured with fatal error
我的操作系统是 64 位 Windows 7。
我想在 C:\Program Files (x86)\Microsoft DirectX SDK(2010 年 6 月)\Samples\C++\Direct3D10\Tutorials\Tutorial02 中构建 DirectX 示例。但是当我构建错误时发生致命错误
LNK1104: 'winmm.lib' can't open the file.
LNK1104: 'winmm.lib' 无法打开文件。
I reinstalled Direct SDK, but no change. I also added the path (include, lib) to the settings.
我重新安装了 Direct SDK,但没有改变。我还在设置中添加了路径(包括、lib)。
If I remove 'winmm.lib' from the project settings, 'comctl32.lib' can't be opened. both libs were already present in properties>Linker>Input.
如果我从项目设置中删除 'winmm.lib',则无法打开 'comctl32.lib'。两个库都已存在于属性>链接器>输入中。
How can I solve this problem?
我怎么解决这个问题?
回答by Marco A.
winmm.lib
isn't part of the DirectX SDK but is part of the Windows SDK.
winmm.lib
不是 DirectX SDK 的一部分,而是Windows SDK 的一部分。
Latest Windows SDK versions were also heavily reorganized but it includes the library you're looking for.
最新的 Windows SDK 版本也进行了大量重组,但它包括您正在寻找的库。
回答by Rokman
Just put the line below in stdafx.h
只需将下面的行放在 stdafx.h 中
#pragma comment(lib, "winmm.lib")
回答by Chuck Walbourn
If you are trying to build any of the legacy DirectX SDK samples with VS 2012 or VS 2013, you need to modify the include/libs paths per the instructions on bottom of the page on MSDN. The most important change is that you must reverse the Include/Lib path order:
如果您尝试使用 VS 2012 或 VS 2013 构建任何旧版 DirectX SDK 示例,则需要按照MSDN页面底部的说明修改包含/库路径。最重要的变化是您必须颠倒 Include/Lib 路径顺序:
For VS 2010 it was:
对于 VS 2010,它是:
$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Lib\x86;$(LibraryPath)
or $(DXSDK_DIR)Lib\x64;$(LibraryPath)
$(DXSDK_DIR)Lib\x86;$(LibraryPath)
或者 $(DXSDK_DIR)Lib\x64;$(LibraryPath)
For VS 2012/2013 it has to be:
对于 VS 2012/2013,它必须是:
$(IncludePath);$(DXSDK_DIR)Include
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x86
or $(LibraryPath);$(DXSDK_DIR)Lib\x64
$(LibraryPath);$(DXSDK_DIR)Lib\x86
或者 $(LibraryPath);$(DXSDK_DIR)Lib\x64
Of course a better option is not spend time learning the older Direct3D 10 API at all, and use the latest Direct3D 11Win32 desktop tutorials on MSDN Code Gallery. In fact, I've posted many of the legacy DirectX SDK samples there so they work fine with VS 2012/2013 Express for Windows Desktop and VS 2012/2013 Pro+ as-is without the DirectX SDK at all.
当然更好的选择是根本不花时间学习旧的 Direct3D 10 API,而使用MSDN Code Gallery上最新的Direct3D 11Win32 桌面教程。事实上,我已经在那里发布了许多旧版 DirectX SDK 示例,因此它们可以与 VS 2012/2013 Express for Windows Desktop 和 VS 2012/2013 Pro+ 一起正常工作,完全没有 DirectX SDK。
Read these blog posts:
阅读这些博客文章:
And review these CodePlex projects:
并查看这些 CodePlex 项目: