4
votes

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

LNK1104: 'winmm.lib' can't open the file.

I reinstalled Direct SDK, but no change. I also added the path (include, lib) to the settings.

If I remove 'winmm.lib' from the project settings, 'comctl32.lib' can't be opened. both libs were already present in properties>Linker>Input.

How can I solve this problem?

3
Where did you add the pathes? Did you check that winmm.lib is present on your hard drive?Werner Henze
It should be in C:/winows/system32 add this path to your library pathesj-p
Those (both) are Windows SDK libraries: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib or around.Roman R.
It will certainly not be in C:/winows/system32 I do not have a single .lib file at all in this folder. Maybe you are thinking about .dlls.drescherjm
LNK1104: 'winmm.lib' can't open the file. Are you mixing x86_64 and x86? Remember you can not use 64 bit libraries in 32 bit applications or 32 bit libraries in 64 bit applications.drescherjm

3 Answers

2
votes

winmm.lib isn't part of the DirectX SDK but is part of the Windows SDK.

Latest Windows SDK versions were also heavily reorganized but it includes the library you're looking for.

2
votes

Just put the line below in stdafx.h

#pragma comment(lib, "winmm.lib")
1
votes

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:

For VS 2010 it was:

$(DXSDK_DIR)Include;$(IncludePath)

$(DXSDK_DIR)Lib\x86;$(LibraryPath) or $(DXSDK_DIR)Lib\x64;$(LibraryPath)

For VS 2012/2013 it has to be:

$(IncludePath);$(DXSDK_DIR)Include

$(LibraryPath);$(DXSDK_DIR)Lib\x86 or $(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 11 Win32 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.

Read these blog posts:

DirectX SDK Samples Catalog

DirectX SDK Tools Catalog

Living without D3DX

DirectX SDKs of a certain age

And review these CodePlex projects:

DirectX Tool Kit

DirectXMesh

DirectXTex

DXUT for Direct3D 11

Effects 11