error with DrawString()

Jul 1, 2015 at 11:15 PM
Edited Jul 1, 2015 at 11:16 PM
Hello everyone! I'm from Russia, therefore my English very bad( I'm sorry in advance
So...I have a problem with SpriteFont. I'm getting this error:
1>Scene.obj : error LNK2019: unresolved external symbol "public: void __fastcall DirectX::SpriteFont::DrawString(class DirectX::SpriteBatch *,wchar_t const *,struct DirectX::XMFLOAT2 const &,struct DirectX::__vector4 const &,float,struct DirectX::XMFLOAT2 const &,float,enum DirectX::SpriteEffects,float)" (?DrawString@SpriteFont@DirectX@@QAIXPAVSpriteBatch@2@PB_WABUXMFLOAT2@2@ABU__vector4@2@M2MW4SpriteEffects@2@M@Z) referenced in function "public: void __thiscall Scene::drawScene(void)" (?drawScene@Scene@@QAEXXZ)
1>D:\Мои документы\Visual Studio 2012 Project\LoadModel\Debug\LoadModel.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

I have watched this video
http://m.youtube.com/watch?v=GCY3pKABBP0
and so I have repeated to him
I have included the headers, I have added the reference end etc.
But I have this problem, which I don't know how to resolve

Does anyone know how to fix that?
Coordinator
Jul 2, 2015 at 4:47 PM
Which version of the VS compiler and project are you using?

Have you tried using the NuGet version?

Are you successfully able to use other components of DirecXTK? One possible issue is if you are building your application with /Zc:wchar_t- (no native wchar_t) as the library is built using /Zc:wchar_t (wchar_t is native type), but that doesnt' seem likely from looking at your error above.
Jul 4, 2015 at 9:45 PM
Which version of the VS compiler and project are you using?
I'm using VS 2012

Have you tried using the NuGet version?
I don't use this product, and I can not use it

Are you successfully able to use other components of DirecXTK? One possible issue is if you are building your application with /Zc:wchar_t- (no native wchar_t) as the library is built using /Zc:wchar_t (wchar_t is native type), but that doesnt' seem likely from looking at your error above.

Tell me in more detail about it. How to fix this problem with Zc:wchar_t ??
Jul 8, 2015 at 10:18 PM
Will anybody help me?
Coordinator
Jul 9, 2015 at 6:56 AM
Edited Jul 9, 2015 at 6:59 AM
I am trying to help, but I don't yet have a clear understanding of your situation. There are many things that could lead to link errors, but if you are able to use other DirectXTK functions and get them to link just not the one with a wchar_t in it, that makes me suspicious of the /Zc:wchar_t- setting.

Perhaps you can summarize how exactly it is you added DirectXTK to your project as that might give some indication of the root cause of the problem.

What platform are you targeting with your app exactly: Windows desktop on Windows 7? Windows phone 8.0, 8.1? Windows Store 8.0, 8.1?

Which release of the DirectX Tool Kit are you using?

Which architecture are you building for: X86, X64, ARM? Do they all fail?

Have you been able to successfully build and run one of the Simple Samples?
Jul 18, 2015 at 11:05 PM
walbourn, I'm able to use other DirectXTK functions, for example
spriteBatch -> Begin; or spriteBatch -> End;
And also my initialize spriteBatch and spriteFont are successfully.
When I use DrawString(..) function, I get the error,which I have already discribed
I don't know,I check /Zc:wchar_t- setting...In two project(my project and DirectXTK) /Zc:wchar_t- set without -. It seems that everything is corrent

I have x86, windows 8 and VS 2012
I don't build and run Simple Samples yet

Maybe you are sent my project with DirectXTK?but where?
Coordinator
Jul 20, 2015 at 7:22 PM
I see the problem now. You are building your application with _XM_NO_INTRINSICS_ set (hence the presence of the type "DirectX::__vector4" in the link signature). DirectX Tool Kit is built using the default _XM_SSE2_INTRINSICS_ setting for x86.

My suggestion is that you remove your use of _XM_NO_INTRINSICS_ and make use of SimpleMath instead which simplifies the use of DirectXMath with intrinsics enabled for x86 apps.
Marked as answer by walbourn on 7/20/2015 at 12:22 PM
Jul 20, 2015 at 7:49 PM
I have downloaded and run DirectXTK Samples. I have been able to successfully build it. I see that DirectXTK don't use xnamath.h...
But I use this library. What shall I do?
Coordinator
Jul 20, 2015 at 11:23 PM
With VS 2012 or later, you are using the Windows 8.0 SDK.
  1. You should use DirectXMath which is a new version of xnamath. See Introducing DirectXMath and MSDN.
  2. If you are using VS 2012 and 'xnamath', then you are still using the legacy DirectX SDK. Be sure to change the VC++ Directory include/lib path order for your project if you really need the legacy DirectX SDK, or remove it if you don't actually need it. See Where is the DirectX SDK?. DirectXTK makes no use of the legacy DirectX SDK and instead relies solely on the Windows 8.x SDK.
Marked as answer by walbourn on 7/20/2015 at 4:23 PM
Jul 24, 2015 at 10:53 PM
Edited Jul 24, 2015 at 10:55 PM
I use the legacy directX sdk and xnamath.h, because I'm beginner in computer graphic. I read Frank Luna Introduction to 3D Game Programming with DirectX 11. Frank uses xnamath.h and the legacy directx sdk. Therefore I don't see anything besides it.
I want to use the new version of sdk, but I don't know how.
Help me please) I badly understand English, so I can't read a lot of text. For example here there are https://msdn.microsoft.com/en-us/library/ee663275.aspx
How do I start to use the new directX sdk?
Coordinator
Jul 25, 2015 at 11:24 PM
With VS 2012 or later, you already have the "new DirectX SDK". You should look at using Visual Studio 2013 or 2015 Community edition rather than any of the Express editions.

Use the DirectX Tool Kit instead of D3DX11.

You can use DirectXMath which is just a newer version of XNAMath (see MSDN for the differences), but as a beginner you should take a look at DirectX Tool Kit's SimpleMath.

You should take a look at the DirectX Tool Kit tutorials as well as this blog post about Frank's excellent but a bit dated book.
Jul 26, 2015 at 1:45 AM
walbourn, ok, I have "new directX sdk" in my VS 2012, but how do I use it? What do I have to include in my project?
"You should look at using Visual Studio 2013 or 2015 Community edition rather than any of the Express editions" - I can't understand this sentence)
By the way, when I downloaded directXTK, I did't find a documentation of it. Where is it, do you know? I need that, because I don't know what to do some classes of this library.
Do you know good books as like as Frank Luna's books?But with new version of directX and XNA?
Doo you have skype?)) I want to talk to the true Englishman))
Coordinator
Jul 27, 2015 at 3:53 AM
Edited Jul 27, 2015 at 3:54 AM
I don't know what version of VS 2012 you are using, but if you are using VS 2012 Express, you should use VS 2013 Community Edition instead.

You don't have to do anything to use the 'new DirectX SDK'. It's built in. You just use the headers & libraries, and the FXC compiler is already part of the VS 2012 & 2013 toolset. As noted on MSDN, you will not have D3DX11.H or XNAMath.h. You do have d3d11.h, DirectXMath.h, etc.

The DirectX Tool Kit documentation is here.
Jul 28, 2015 at 8:28 PM
I use VS 2012 ultimate
You don't answer me...do you have the skype?