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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:41:59  来源:igfitidea点击:

Where can I find 'winmm.lib' (I'm using Visual Studio 2012)

c++visual-studio-2012directxwinmm

提问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.libisn'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\x86or $(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:

阅读这些博客文章:

DirectX SDK Samples Catalog

DirectX SDK 示例目录

DirectX SDK Tools Catalog

DirectX SDK 工具目录

Living without D3DX

没有 D3DX 的生活

DirectX SDKs of a certain age

某个时代的 DirectX SDK

And review these CodePlex projects:

并查看这些 CodePlex 项目:

DirectX Tool Kit

DirectX 工具包

DirectXMesh

DirectXMesh

DirectXTex

直通车

DXUT for Direct3D 11

适用于 Direct3D 11 的 DXUT

Effects 11

效果 11