Using DirectXTex Library - c++

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

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.

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.

Related

Google Protocol buffer c++ link error when trying to use it in project

I am trying to get protocol buffer to work but linking problems occurs.
All the errors looks something along like this
error LNK2019: unresolved external symbol "public: bool __cdecl google::protobuf::MessageLite::ParseFromArray(void const *,int)" (?ParseFromArray#MessageLite#protobuf#google##QEAA_NPEBXH#Z) referenced in function "void __cdecl ReceiveRequest(bool *)" (?ReceiveRequest##YAXPEA_N#Z)
I am using visual studio pro 2013 and this is what I have done:
I compiled the protocol buffer and added the libprotobuf.lib to the project(Add->Existing Item->libprotobuf.lib)
I've added the header files in C/C++ -> General -> "Additional Include Directories"
I have tried to add the library all the different ways I know but I still get these linking errors...
Any idea what I might have done wrong?
// Eric
You need to include the generated protocol buffer .cc (and maybe the .h) file (ie the file with the specific getters and setters for your specific proto) in your VS project (ie there has to be a little icon for them in the solution explorer) or else visual studio won't generate the code for it and thus there's nothing to link to.
Make sure you have the correct libraries for your architecture (e.g. x86 / x64).
That has caught me out a few times.

Compile Tesseract for Visual Studio 2013

I'm trying to use the tesseract in visual studio 2013. I'm using "libtesseract302.lib" in the the linker -> Input (not "libtesseract302-static.lib") and everythings was OK, and it's compiled and run, but when I tried to use this code:
tesseract::ResultIterator* ri;
tesseract::ChoiceIterator ci(*ri);
I got five link errors like this:
Error 3 error LNK2028: unresolved token (0A000567)
"public: __thiscall tesseract::ChoiceIterator::ChoiceIterator
(class tesseract::LTRResultIterator const &)"
(??0ChoiceIterator#tesseract##$$FQAE#ABVLTRResultIterator#1##Z)
referenced in function "int __cdecl main(void)" (?main##$$HYAHXZ)
I think it's because I didn't use the static library, so I tried that, but I got many linking errors. I think that is due to the static library having been built before using vs2008 that I got from here.
Tesseract
So I'm trying now to compile the tesseract as static lib in vs2013. Will solve the issue, or should I try something else?

Updating FBX SDK Model loading from 2012.2 to 2014.1 SDK

I've just ported over and updated a bunch of FBX model loading code I had that worked with Direct X 10 to try and make it work with Direct X 11. Since that time, the FBX SDK I was using has been updated.
In my old program I linked to the following lib:
fbxsdk-2012.2-mdd.lib
Now, clearly I can't link to this as I don't have 2012.2 on my system. So, my thinking would be simply changing 2012.2 to 2014.1, but this didn't work and lead to the following error:
error LNK1104: cannot open file 'fbxsdk-2014.1-mdd.lib'
So I tried to some googleing to see what the updated version of fbxsdk-2012.2-mdd.lib is. But I can't find anything. I tried taking out linking ot the 2014.1 lib but I get the following errors:
Error 36 error LNK2019: unresolved external symbol "void __cdecl fbxsdk_2014_1::FbxAssert(char const *,char const *,unsigned int,char const *)" (?FbxAssert#fbxsdk_2014_1##YAXPBD0I0#Z) referenced in function "public: int & __thiscall fbxsdk_2014_1::FbxArray::operatorconst " (??A?$FbxArray#H#fbxsdk_2014_1##QBEAAHH#Z)
So, looking in the FBX sample directory I opened up the ViewScene sample to see what it lib it linked to and I see that it wanted the following:
libfbxsdk-md.lib
So I did the same. But, my program claims it cannot open the file. And I'm at a loss as to what to do next.
Has anyone successfully managed to load FBX models into a Directx 11 application using 2014.1? If so, what do I need to do to get the correct lib linked?
had a similar problem this is what i did ...i read it around here in stackoverflow somewhere
anyway
"first change parameters, tools->option->debugging->symbol->server,yes thenCtrl+F5,then you will see amazing things "
libfbxsdk-md.lib is in both debug/release lib folders, so Visual Studio is confused. The full debug/release lib folder path in the Visual Studio property pages must be included separately for debug/release settings.

Error in DirectX example from Microsoft

I'm trying to learn C++ and DirectX, got VS 2012 Express Desktop today for Windows 7. I should probably mention I already had DirectX SDK for VS 2010 installed.
The first of the 7 tutorials will compile fine, the rest are giving errors. Because the first one runs I think my include and library directories are set up fine.
Source is here, I put the .fx file in at the bottom as well as the compiler errors. If you don't want to click megafileupload it's just the DirectX draw a triangle tutorial (2) from Microsoft.
Tutorial files on megaupload
Warning 1 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification C:\cpp\DirectX_Tutorial\C++\Tutorial02\Tutorial02.obj Tutorial02
Error 2 error LNK2019: unresolved external symbol _D3DCompileFromFile#36 referenced in function "long __cdecl CompileShaderFromFile(wchar_t *,char const *,char const *,struct ID3D10Blob * *)" (?CompileShaderFromFile##YAJPA_WPBD1PAPAUID3D10Blob###Z) C:\cpp\DirectX_Tutorial\C++\Tutorial02\Tutorial02.obj Tutorial02
Error 3 error LNK1120: 1 unresolved externals C:\cpp\DirectX_Tutorial\C++\Debug\Tutorial02.exe Tutorial02
Also is there a forum here I can rant on? C++, the Windows API, DirectX, and Visual Studio are all just so unnecessarily difficult to use.
Recheck if your import libraries are correct and if you're importing from the folder corresponding to your processor architecture.
Also, double check project's encoding, directx doesnt usually work well on encodings other than Unicode.

Building and linking test code for Crypto++

I'm trying to write some simple test code for the Crypto++ library for a project. I have yet to manage to get my own code to build though. It compiles fine, the problem comes in linking. I'm still pretty new to Visual Studios, but I'm using VS10. The errors I'm getting are:
1>sec_test.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::DES::Base::ProcessAndXorBlock(unsigned char const *,unsigned char const *,unsigned char *)const " (?ProcessAndXorBlock#Base#DES#CryptoPP##UBEXPBE0PAE#Z)
1>sec_test.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::DES::Base::UncheckedSetKey(unsigned char const *,unsigned int,class CryptoPP::NameValuePairs const &)" (?UncheckedSetKey#Base#DES#CryptoPP##UAEXPBEIABVNameValuePairs#3##Z)
I've tried everything I can find in the documentation in terms of linking. I've never linked against a DLL before, but these are the errors I get when I try to. If I try to do what I think is linking against the static library version, I get even more.
I should note, I'm trying to test pure DES at the moment. In particular, here are the API calls I'm making, just to be safe:
DES::Encryption DES_encrypt;
DES_encrypt.SetKey(key, 64);
DES_encrypt.ProcessAndXorBlock(plaintext, NULL, ciphertext);
DES::Decryption DES_decrypt;
DES_decrypt.SetKey(key, 64);
DES_decrypt.ProcessAndXorBlock(ciphertext, NULL, decrypted);
If anyone can help, or point me in the right direction, I'd be much obliged.
First thing to check is your project properties (right click on project, click Properties).
External libraries need to be specified in the Linker->Input->Additional Dependencies field, either by absolute path or in conjunction with the other VS path properties.
You can look in Linker->Command Line and check that the .lib files you want are actually being passed to the linker.
An alternate method is to turn off the Suppress Startup Banner option in the Linker->General options, and then check the build output to make sure it has what you want.
If you know that the libraries you want are being linked, another useful trick is to check the output of the strings command (in linux or cygwin) or dumpbin /HEADERS in the VS command prompt. You can look through the output of these commands for the symbol VS claims is missing to verify that it really is defined in the .lib file. Sometimes larger software packages have multiple .lib files, so this can help make sure you are linking the one that has the symbol you want.