Mikael Törnqvist
Mikael Törnqvist

Reputation: 339

Using DirectXTex Library

I am trying to update my DirectX Project to the new Windows 8.1 sdk (2013 or something) and get rid of DirectX SDK june 2010. I have come far, but I am stuck at a Linker error LNK2001

Error 3 error LNK2001: unresolved external symbol "long __cdecl DirectX::CreateDDSTextureFromFile(struct ID3D11Device *,wchar_t const *,struct ID3D11Resource * *,struct ID3D11ShaderResourceView * *,unsigned int,enum DirectX::DDS_ALPHA_MODE *)" (?CreateDDSTextureFromFile@DirectX@@YAJPAUID3D11Device@@PB_WPAPAUID3D11Resource@@PAPAUID3D11ShaderResourceView@@IPAW4DDS_ALPHA_MODE@1@@Z) C:\Users\DimmerFan\documents\visual studio 2013\Projects\MikaelD3D\MikaelD3D\TextureClass.obj MikaelD3D

I guess that doesnt say much. This is the code with the error:

HRESULT result;

result = DirectX::CreateDDSTextureFromFile(device, filename, nullptr, &m_texture, 0, nullptr);
if (FAILED(result))
{
    return false;
}

return true;

Where I get this function DirectX::CreateDDSTextureFromFile from the DirectXTex SDK. However I somehow fail to include this library to my Project. I dont know what could have gone wrong. Intellisence pops up and Everything looks good. I have included the D:\DirectXTex\DDSTextureLoader To my Include Directorys and I am including #include <DDSTextureLoader.h> Thanks for any help about this error

//Mikael Törnqvist

Upvotes: 2

Views: 4105

Answers (2)

Chuck Walbourn
Chuck Walbourn

Reputation: 221

DirectXTex's package includes the 'standalone' versions of DDSTextureLoader, WICTextureLoader, and ScreenGrab. You drop the .cpp and .h files into your project as they are not included in the DirectXTex.lib.

DirectX Tool Kit has the 'integrated' versions of those same modules, so they are in the DirectXTK.lib.

Why are there two versions of the same files you ask? See my blog post on the topic.

Upvotes: 2

zdd
zdd

Reputation: 8717

You can try to add DDSTextureLoader.h and DDSTextureLoader.cpp to your project, DirectXTex was provided as source code, if you want to use it, you should add it to your solution/project.

You can also build the DirectXTex project yourself, and use the headers and libs.

Upvotes: 4

Related Questions