13 Replies - 877 Views - Last Post: 15 June 2015 - 09:26 PM Rate Topic: -----

#1 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 13 June 2015 - 05:58 AM

Hi, I am using a book to learn DirectX 11. My IDE is Visual Studio 2015 and the programming language I am using is VS C++.
The companion code, downloaded from the publisher's site, contains the following part:
if( FAILED( result ) )
{
   DXTRACE_MSG( "Failed to create the Direct3D device!" );
    return false;
}


The meaning of the code is clear. To use it, I either need to add an L in front of "Failed..." or I have to switch to use "Use Multi-Byte Character Set". I tried both and chose the L:

if( FAILED( result ) )
{
   DXTRACE_MSG( L"Failed to create the Direct3D device!" );
    return false;
}


So far no problems.

However, my program will not work if one of those DXTRACE_MSG() message is not commented out. If they are commented out, Visual Studio will create a perfectly working window without any complaining.

This is Visual Studio's output in case the DXTRACE_MSG()s are included:

All packages are already installed and there is nothing to restore.
NuGet package restore finished.
1>------ Build started: Project: DirectX11Programming, Configuration: Debug x64 ------
1> DirectX11Base.cpp
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(12): warning C4005: 'DXGI_STATUS_OCCLUDED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51172): note: see previous definition of 'DXGI_STATUS_OCCLUDED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(13): warning C4005: 'DXGI_STATUS_CLIPPED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51181): note: see previous definition of 'DXGI_STATUS_CLIPPED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(14): warning C4005: 'DXGI_STATUS_NO_REDIRECTION': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51190): note: see previous definition of 'DXGI_STATUS_NO_REDIRECTION'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(15): warning C4005: 'DXGI_STATUS_NO_DESKTOP_ACCESS': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51199): note: see previous definition of 'DXGI_STATUS_NO_DESKTOP_ACCESS'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(16): warning C4005: 'DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51208): note: see previous definition of 'DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(17): warning C4005: 'DXGI_STATUS_MODE_CHANGED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51217): note: see previous definition of 'DXGI_STATUS_MODE_CHANGED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(18): warning C4005: 'DXGI_STATUS_MODE_CHANGE_IN_PROGRESS': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51226): note: see previous definition of 'DXGI_STATUS_MODE_CHANGE_IN_PROGRESS'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(21): warning C4005: 'DXGI_ERROR_INVALID_CALL': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51241): note: see previous definition of 'DXGI_ERROR_INVALID_CALL'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(22): warning C4005: 'DXGI_ERROR_NOT_FOUND': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51250): note: see previous definition of 'DXGI_ERROR_NOT_FOUND'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(23): warning C4005: 'DXGI_ERROR_MORE_DATA': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51259): note: see previous definition of 'DXGI_ERROR_MORE_DATA'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(24): warning C4005: 'DXGI_ERROR_UNSUPPORTED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51268): note: see previous definition of 'DXGI_ERROR_UNSUPPORTED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(25): warning C4005: 'DXGI_ERROR_DEVICE_REMOVED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51277): note: see previous definition of 'DXGI_ERROR_DEVICE_REMOVED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(26): warning C4005: 'DXGI_ERROR_DEVICE_HUNG': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51286): note: see previous definition of 'DXGI_ERROR_DEVICE_HUNG'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(27): warning C4005: 'DXGI_ERROR_DEVICE_RESET': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51296): note: see previous definition of 'DXGI_ERROR_DEVICE_RESET'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(28): warning C4005: 'DXGI_ERROR_WAS_STILL_DRAWING': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51305): note: see previous definition of 'DXGI_ERROR_WAS_STILL_DRAWING'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(29): warning C4005: 'DXGI_ERROR_FRAME_STATISTICS_DISJOINT': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51315): note: see previous definition of 'DXGI_ERROR_FRAME_STATISTICS_DISJOINT'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(30): warning C4005: 'DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51324): note: see previous definition of 'DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(31): warning C4005: 'DXGI_ERROR_DRIVER_INTERNAL_ERROR': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51334): note: see previous definition of 'DXGI_ERROR_DRIVER_INTERNAL_ERROR'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(32): warning C4005: 'DXGI_ERROR_NONEXCLUSIVE': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51343): note: see previous definition of 'DXGI_ERROR_NONEXCLUSIVE'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(33): warning C4005: 'DXGI_ERROR_NOT_CURRENTLY_AVAILABLE': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51352): note: see previous definition of 'DXGI_ERROR_NOT_CURRENTLY_AVAILABLE'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(34): warning C4005: 'DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51362): note: see previous definition of 'DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(35): warning C4005: 'DXGI_ERROR_REMOTE_OUTOFMEMORY': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51371): note: see previous definition of 'DXGI_ERROR_REMOTE_OUTOFMEMORY'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11.h(917): warning C4005: 'D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51576): note: see previous definition of 'D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11.h(918): warning C4005: 'D3D11_ERROR_FILE_NOT_FOUND': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51585): note: see previous definition of 'D3D11_ERROR_FILE_NOT_FOUND'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11.h(919): warning C4005: 'D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51595): note: see previous definition of 'D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11.h(920): warning C4005: 'D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51604): note: see previous definition of 'D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d10.h(608): warning C4005: 'D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51552): note: see previous definition of 'D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d10.h(609): warning C4005: 'D3D10_ERROR_FILE_NOT_FOUND': macro redefinition
1> c:\program files (x86)\windows kits\10\include\10.0.10069.0\shared\winerror.h(51561): note: see previous definition of 'D3D10_ERROR_FILE_NOT_FOUND'
1>dxerr.lib(dxerrw.obj) : error LNK2019: unresolved external symbol _vsnwprintf referenced in function "long __cdecl StringVPrintfWorkerW(unsigned short *,unsigned __int64,unsigned __int64 *,unsigned short const *,char *)" (?StringVPrintfWorkerW@@YAJPEAG_KPEA_KPEBGPEAD@Z)
1>C:\Users\Super-Administrator\Google Drive\C++ Programming\Learning DirectX 11\DirectX 11 Programming\DirectX11Programming\x64\Debug\DirectX11Programming.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Could this be connected to the fact that I chose a 64 bit project instead of an 32 bit one? Until now, this is the biggest difference between my code and the one from the book apart from some different class names.

Or should I simply use an alternative to return error messages in combination with the termination of the program? If yes, what would be useful alternatives?

This post has been edited by WilliC++: 13 June 2015 - 06:03 AM


Is This A Good Question/Topic? 0
  • +

Replies To: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

#2 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 13 June 2015 - 07:13 AM

My question doesn't matter anymore. While the book is good, the code isn't or at least not with my software. Trying to render will result in a unresolved exception because on variable is zero and so on.

I am using now something different.
Was This Post Helpful? 0
  • +
  • -

#3 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1601
  • View blog
  • Posts: 5,564
  • Joined: 19-February 09

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 13 June 2015 - 06:59 PM

Hi, it could well be the 64-bit build. A 64-bit function's signature is different from a 32-bit function's signature, so dxerr.lib may not contain a 64-bit function.

Where's DXERR.LIB?

You can use a TEXT macro with strings.

if( FAILED( result ) )
{
   DXTRACE_MSG( TEXT( "Failed to create the Direct3D device!" ) );
   return false;
}



A shorter version _T() is often used.
Was This Post Helpful? 1
  • +
  • -

#4 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 712
  • View blog
  • Posts: 1,671
  • Joined: 24-April 12

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 13 June 2015 - 07:22 PM

DX is kind of tricky to get running. It's very finicky about what it wants to run. First of all, you have to have a graphics card that supports that version of DX.

And then I believe DX11.1 requires at least Windows 7 SP1. And DX11.2 requires at least Windows 8.1 and a graphics card that will run 11.2.

Then there are issues of backwards compatibility, especially if you are not fully embracing Windows 8. I tried to only use the preferred way of doing things and discovered the hard way why a lot of these books are using deprecated code features. You almost have to. DX11 doesn't know how to handle keyboards which is... um... kind of important unless you're ready to just go full out Xbox 360 controller which it handles fine. I mean, I want all games to use the Xbox 360 controller instead of the keyboard, but a lot of times it's easier for a test or whatever to just use the keyboard I already have in my hand.

I suppose you can use the Windows event loop. I have no idea how WinRT wants to handle it and maybe that's the issue. But to get low level keyboard support you have to use DX8. (Not even DX9.) And there's other stuff like that that it's just a lot easier to use deprecated features to get the job done and/or it's basically impossible to do without using deprecated features.

So everyone does it and then you have to have DX 11 separately installed from the Windows SDK that is supposed to be all you need to run DX. It is... if you are not supporting Windows 7 and are only doing Windows 8 or higher I suppose. (Any deprecated features are going to have to have the separately loaded DX11 install - even features that are Windows 7 features and thus basically deprecated by are DX11. So, again, there are DX11 features that are deprecated just because you're doing Windows 7 and that requires a dual install of DX.) For everyone else, you basically have to have two versions of DX11 installed. :death: Then you have to get it to point to both versions in the correct order to link.

You're welcome to download my code off my website. It runs fine on my Windows 7 machine. I haven't tested it on much of anything else. It's working code anyway. I just finished getting my rigid model class working the other day. I still need to clean up the code before really releasing it, but I can post it if you're really interested. But there's other previous code examples there.

I'm working all weekend this weekend and probably semi-busy the next couple of weekends. Plus, I'm trying to do a video series on beginning HLSL on my YouTube channel as soon as I can find the time to record the video as the code and everything is ready to shoot. (I actually shot for two hours and had a computer crash that lost the video I had recorded up to that point.)

This post has been edited by BBeck: 13 June 2015 - 07:31 PM

Was This Post Helpful? 1
  • +
  • -

#5 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 14 June 2015 - 04:29 AM

Thanks, I know that my NVIDIA graphics card can handle the code I tried to run. Apart from that, I used the same DirectX SDK version than the book and I manually added all the dependencies including file paths to Visual Studio. But I haven't considered the OS. The code was most likely developed on a Windows 7 machine and I am using Windows 10 Enterprise Preview. Nevertheless, I hate Windows Apps, so I am programming a traditional, legacy Windows application which should run on every DirectX 11 capable machine, especially considering that I only used basic features to initialize DirectX, not even drawing something yet. Apart from that, the code includes a feature level check (DirectX 11, DirectX10.1 and DirectX 10). Furthermore, if the graphics card wouldn't have supported the the feature, the code would have automatically switched to software rendering, which is (supposedly slow (I haven't tried it myself)) but should do the job.

I am currently using a website to learn DirectX and not the book so I am not going to try to get the code working, which would be to difficult, considering that I am a complete beginner in DirectX, but not in Windows programming (some experience) or VS C++ (intermediate to experienced).

This post has been edited by Skydiver: 15 June 2015 - 10:19 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#6 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 14 June 2015 - 02:56 PM

After having finished to learn the very basics of DirectX11 via a website, I returned to the book as it is very good in explaining the code and in teaching good coding practice. I have been able to get rid of all errors, except the one I started this thread for.

Using this code still results in an error:
if( FAILED( result ) )
	{
	   DXTRACE_MSG( L"Failed to create the Direct3D device!" );
	    return false;
	}


To get the program running I have commented out all three occurrences of DXTRACE_MSG. If I need precise warning, I can still use pop up windows. Nevertheless, if someone knows why it doesn't work or if 64 bit is the cause, the 64 bit equivalent, I would be interested in knowing.

As that line of code is independent of the rest of my code, I doubt posting it would make much sense. However if needed, I would do it.
Was This Post Helpful? 0
  • +
  • -

#7 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 712
  • View blog
  • Posts: 1,671
  • Joined: 24-April 12

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 14 June 2015 - 04:47 PM

I'm not sure. But now that you mention it. I remember there being a problem with DXTRACE_MSG. I remember having to comment out all my HRESULT error checking on one machine where I was trying to get DX11 to run.

See if this answers your question, but I remember there being a specific problem with that stuff.

I believe this goes back to what I was saying about using deprecated stuff (like error checking?) mean you have to have the separate DX11 SDK installed in addition to the Windows SDK.

On my primary machine I already had both installed and so I didn't have any problems. But then I tried to run the same code on a machine that didn't have the separate DX11 SDK installed and I got errors like this.

This post has been edited by BBeck: 14 June 2015 - 04:51 PM

Was This Post Helpful? 1
  • +
  • -

#8 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 12:05 AM

This is the file path of my manual install:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)
I know that using the built in version would lead to trouble, especially using Windows 10, so I manually installed the old version from Microsoft before starting to write my first DirectX 11 program. I even manually added the necessary file paths to Visual Studio.

I still have to check the link. If there is a general problem with this macro, I know alternatives, so this isn't a very huge problem, but still a bit of annoying.

This post has been edited by Skydiver: 15 June 2015 - 10:19 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#9 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 712
  • View blog
  • Posts: 1,671
  • Joined: 24-April 12

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 03:47 AM

I swear I did a post on these directories within the past two months but I cannot find it.

Anyway, here is what I have under Configuration Properties-->VC++ Directories:

For 32bit:
Executable Directories:$(WindowsSDK_ExecutablePath);$(ExecutablePath);$(DXSDK_DIR)Utilities\Bin\x86
Include Directories:$(WindowsSDK_IncludePath);$(IncludePath);$(DXSDK_DIR)Include
Library Directories:$(DXSDK_DIR)Lib\x86;$(WindowsSDK_LibraryPath);$(LibraryPath)

For 64bit:
Executable Directories:$(WindowsSDK_ExecutablePath);$(ExecutablePath);$(DXSDK_DIR)Utilities\Bin\x64
Include Directories:$(WindowsSDK_IncludePath);$(IncludePath);$(DXSDK_DIR)Include
Library Directories:$(DXSDK_DIR)Lib\x64;$(WindowsSDK_LibraryPath);$(LibraryPath)

Notice that I have it pointing to two completely different versions of DX11 (DXSDK_DIR) and (WindowsSDK_). The order seems to be critical because it will search those paths in that order. I also don't use any direct references to the actual folders such as "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)". I believe (DXSDK_DIR) "should" be pointing there.

I haven't explored this too deeply. I've only been doing DX for about a year and a half. So, I'm still fairly new to it. And I think I accidently installed both versions of DX early on trying to get it to work without really understanding what I was doing. So, it worked for me without a lot of the error problems pretty early on. But I still had issues every time I started a new project with getting these directories pointed to in the proper order.

I tried to get DX11 working on my laptop, which is also Win7, but I had some issues that probably boiled down to it not being a DX11 graphics card (built into the motherboard) and not having that second copy of DX11 installed. That's where I really ran into these issues like you're having here, but I gave up on getting it working since I wasn't even sure that it had a compatible GPU in it. I never did try installing the DX11 SDK separately from the Win SDK.

A lot of this is probably due to other deprecated functionality. I read here, "As noted on MSDN, all versions of D3DX are deprecated and are not shipped with the Windows 8.x SDK. This includes D3DX9, D3DX10, and D3DX11." Notice that DX11 is deprecated in DX11 here. My understanding is that what that's really saying is Windows 7 is "deprecated" in DX11.

I also read this but their recommendation for directories did not work for me and so I have my own.

Quote

D3DX is not considered the canonical API for using Direct3D in Windows 8 and later and therefore isn't included with the corresponding Windows SDK. Investigate alternate solutions for working with the Direct3D API. For legacy projects, such as the Windows 7 (and earlier) DirectX SDK samples, the following steps are necessary to build applications with D3DX using the DirectX SDK:

https://msdn.microso...p/ee663275.aspx


In the earlier link I (and first #define) posted it says that DXERR.LIB is officially deprecated and MS recommends not using it. That's great except all the DX11 tutorial code in the world uses it. It specifically says the macro DXTRACE_MSG is deprecated.

It also says:

Quote

If you are still using legacy components like D3DX, DXUT, etc. from the DirectX SDK then you can continue to link to the legacy version of DXERR.LIB as well. For those wanting to get away from dependancies on the DirectX SDK as we've recommended, I've attached a streamlined version of the library to this post. It only supports UNICODE and I had to change DXGetErrorDescription to copy the result to a buffer rather than return a static string in order to make use of FormatMessage where possible, but otherwise it should serve much the same purpose. You can modify it to suit your needs a well.


So, what I get out of that is that it's saying "you can't use any of the error checking functionality and have to build your own" which is probably why everyone ignores that and links in the deprecated DX11 SDK.

I fought against using deprecated functionality until I came across this. Once I saw that core DX11 functionality in DX11 is deprecated, I decided to completely stop fighting it and became super comfortable using the deprecated functionality. That's also about when I realized everyone else writing tutorials is doing the same. What I get out of all that is that Microsoft is saying, "Stop using Windows 7". But it also sounds to me that even for Win10, they are saying you need to rewrite your DX11 code to do your own error handling because they aren't going to do it for you anymore.

Plus, I think most of the DX11 tutorials and books you are likely to find are written for Windows 7.

My attitude at this point has been that DX12 is coming out at the end of this year and I'll wait and see if they've put back in basic functionality like keyboard handling and error handling, but until then I'm just going to use the deprecated functionality by linking in the separate DX11 SDK that is separate from the Win SDK. But I still use the Win SDK versions as much as possible.

A lot of what you originally listed is warnings too, not errors. And a lot of them say "redefinition". That sounds like getting the two versions of DX11 crossed and may get into what I was saying about having them in a specific order.

This post has been edited by BBeck: 15 June 2015 - 03:58 AM

Was This Post Helpful? 2
  • +
  • -

#10 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 712
  • View blog
  • Posts: 1,671
  • Joined: 24-April 12

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 08:07 AM

This is very firmly a "Game Development" forum question by the way. ;-)
Was This Post Helpful? 0
  • +
  • -

#11 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 4179
  • View blog
  • Posts: 13,334
  • Joined: 05-May 12

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 10:18 AM

Moved to "Game Development"

: There is no need to quote the entire post directly above yours. If there is a specific item you want to highlight or respond to, just quote that line/sentence.
Was This Post Helpful? 0
  • +
  • -

#12 WilliC++  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 24-January 15

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 11:02 AM

View PostBBeck, on 15 June 2015 - 03:47 AM, said:

I swear I did a post on these directories within the past two months but I cannot find it.

Anyway, here is what I have under Configuration Properties-->VC++ Directories:

For 32bit:
Executable Directories:$(WindowsSDK_ExecutablePath);$(ExecutablePath);$(DXSDK_DIR)Utilities\Bin\x86
Include Directories:$(WindowsSDK_IncludePath);$(IncludePath);$(DXSDK_DIR)Include
Library Directories:$(DXSDK_DIR)Lib\x86;$(WindowsSDK_LibraryPath);$(LibraryPath)

For 64bit:
Executable Directories:$(WindowsSDK_ExecutablePath);$(ExecutablePath);$(DXSDK_DIR)Utilities\Bin\x64
Include Directories:$(WindowsSDK_IncludePath);$(IncludePath);$(DXSDK_DIR)Include
Library Directories:$(DXSDK_DIR)Lib\x64;$(WindowsSDK_LibraryPath);$(LibraryPath)

Notice that I have it pointing to two completely different versions of DX11 (DXSDK_DIR) and (WindowsSDK_). The order seems to be critical because it will search those paths in that order. I also don't use any direct references to the actual folders such as "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)". I believe (DXSDK_DIR) "should" be pointing there.

I haven't explored this too deeply. I've only been doing DX for about a year and a half. So, I'm still fairly new to it. And I think I accidently installed both versions of DX early on trying to get it to work without really understanding what I was doing. So, it worked for me without a lot of the error problems pretty early on. But I still had issues every time I started a new project with getting these directories pointed to in the proper order.

I tried to get DX11 working on my laptop, which is also Win7, but I had some issues that probably boiled down to it not being a DX11 graphics card (built into the motherboard) and not having that second copy of DX11 installed. That's where I really ran into these issues like you're having here, but I gave up on getting it working since I wasn't even sure that it had a compatible GPU in it. I never did try installing the DX11 SDK separately from the Win SDK.

A lot of this is probably due to other deprecated functionality. I read here, "As noted on MSDN, all versions of D3DX are deprecated and are not shipped with the Windows 8.x SDK. This includes D3DX9, D3DX10, and D3DX11." Notice that DX11 is deprecated in DX11 here. My understanding is that what that's really saying is Windows 7 is "deprecated" in DX11.

I also read this but their recommendation for directories did not work for me and so I have my own.

Quote

D3DX is not considered the canonical API for using Direct3D in Windows 8 and later and therefore isn't included with the corresponding Windows SDK. Investigate alternate solutions for working with the Direct3D API. For legacy projects, such as the Windows 7 (and earlier) DirectX SDK samples, the following steps are necessary to build applications with D3DX using the DirectX SDK:

https://msdn.microso...p/ee663275.aspx


In the earlier link I (and first #define) posted it says that DXERR.LIB is officially deprecated and MS recommends not using it. That's great except all the DX11 tutorial code in the world uses it. It specifically says the macro DXTRACE_MSG is deprecated.

It also says:

Quote

If you are still using legacy components like D3DX, DXUT, etc. from the DirectX SDK then you can continue to link to the legacy version of DXERR.LIB as well. For those wanting to get away from dependancies on the DirectX SDK as we've recommended, I've attached a streamlined version of the library to this post. It only supports UNICODE and I had to change DXGetErrorDescription to copy the result to a buffer rather than return a static string in order to make use of FormatMessage where possible, but otherwise it should serve much the same purpose. You can modify it to suit your needs a well.


So, what I get out of that is that it's saying "you can't use any of the error checking functionality and have to build your own" which is probably why everyone ignores that and links in the deprecated DX11 SDK.

I fought against using deprecated functionality until I came across this. Once I saw that core DX11 functionality in DX11 is deprecated, I decided to completely stop fighting it and became super comfortable using the deprecated functionality. That's also about when I realized everyone else writing tutorials is doing the same. What I get out of all that is that Microsoft is saying, "Stop using Windows 7". But it also sounds to me that even for Win10, they are saying you need to rewrite your DX11 code to do your own error handling because they aren't going to do it for you anymore.

Plus, I think most of the DX11 tutorials and books you are likely to find are written for Windows 7.

My attitude at this point has been that DX12 is coming out at the end of this year and I'll wait and see if they've put back in basic functionality like keyboard handling and error handling, but until then I'm just going to use the deprecated functionality by linking in the separate DX11 SDK that is separate from the Win SDK. But I still use the Win SDK versions as much as possible.

A lot of what you originally listed is warnings too, not errors. And a lot of them say "redefinition". That sounds like getting the two versions of DX11 crossed and may get into what I was saying about having them in a specific order.


Thanks for the information. The file path I posted was just the install directory of DirectX SDK June 2010, not the linking path for Visual Studio. As far as I know, you have to directly link to the precise folders (haven't tried something else but I would be very surprised if something else would work). This hasn't been the problem, though.

Unlike you, I haven't linked to two different versions of DirectX11 SDK, but only to the old one. For the time being, I will simply not use error messages at all as I have better things to do than trying to get them work or I will use popup Windows. If I have learned DirectX, I might invest some time in them but until then, I simply don't care, unless I am bored at an evening and get them working.

I agree with you, that discontinued functionality are quite annoying especially if they are of importance and not replaced. From what I have seen, a lot of tutorials recommend using depreciated versions/functionality. I personally don't see a problem with that. If you still get Anno 1604 running, warning you that it might not be compatible with Windows NT, then there is nothing to worry. Microsoft goes great ways to ensure backward compatibility and this includes old and even archaic versions of DirectX.

It is just annoying that Microsoft's own, newest to-be-released in the future Visual Studio 2015 still cannot find DirectX own its own. One might think that Microsoft would be eager to make it easy to use their technology.

This post has been edited by WilliC++: 15 June 2015 - 11:07 AM

Was This Post Helpful? 0
  • +
  • -

#13 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1601
  • View blog
  • Posts: 5,564
  • Joined: 19-February 09

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 12:16 PM

Hi, remember there usually no need to include the quote of the previous post in your answer. You can either delete it in your post or just use reply when posting.

There is no joy along the DirectX path, so looking again I realised that the error was caused by vsnwprintf. The printf's and scanf's were deprecated in 32-bit compiling, with preference given to security versions, so it makes sense that they are dropped in the 64-bit compiler.


The vsnwprintf function is the variable arguments, to string, sized, wide printf. The security version vsnwprintf_s has a buffer size.

int _vsnwprintf(
   wchar_t *buffer,
   size_t count,
   const wchar_t *format,
   va_list argptr 
);

int _vsnwprintf_s(
   wchar_t *buffer,
   size_t sizeOfBuffer,
   size_t count,
   const wchar_t *format,
   va_list argptr 
);




So a macro should work, but I'm not sure how to handle the size of the buffer as yet, need to find out more about the buffer :

#define vsnwprintf(buffer, count, format, argptr) vsnwprintf_s(buffer, ?sizeOfBuffer?, count, format, argptr)


Was This Post Helpful? 1
  • +
  • -

#14 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1601
  • View blog
  • Posts: 5,564
  • Joined: 19-February 09

Re: C++ DirectX 11 DXTRACE_MSG() error LINK2019:unresolved external symbol

Posted 15 June 2015 - 09:26 PM

Hi, the macro idea will not work because DXTRACE_MSG calls a DXTrace function, so the vsnwprintf function will be in a library.

You could remove the calls to DXTRACE_MSG something like this:

#include <iostream>

using namespace std;

void dxtrace(char *str)
{
  cout << str << endl;
}

// original define
#define DXTRACE_MSG(str) dxtrace(str)

// create a new define
#undef  DXTRACE_MSG
#define DXTRACE_MSG(str) 

// this might work as well
//#define DXTRACE_MSG


int main()
{
  DXTRACE_MSG("testing");

  return 0;
}




Or we can make an attempt at creating the function. The sizeOfBuffer parameter I've set to count + 1. I think that's right for wide characters but not tested. It should probably be apparent if wrong.

#include <windows.h>

int vsnwprintf( wchar_t *buffer, size_t count, const wchar_t *format, va_list argptr )
{
 return vsnwprintf_s(buffer, count+1, count, format, argptr );
}


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1