Sample project

Jun 22, 2012 at 3:52 AM

It's been a while since I've done C++.  Been doing C# for a while.

Can you post a C++ solution that has a sample project and the DirectXTK project.  The sample project should have the library and include files already setup?  That way, if I make a change inside of the DirectXTK project, it would recompile and the sample project would use the new library file.

I forget how to do the relative path setup.

Thanks, Doug

Coordinator
Jun 22, 2012 at 7:59 AM

Actually with VS 2010 and VS 2012, this is pretty simple to do.

Create a new project using one of the standard templates for Win32 Application or Direct3D apps (for Metro style apps).

Add to the solution an "Existing Project" and add DirectXTK.

Add a "Reference" so that your new project depends on DirectXTK.

The only thing you need to add is your current project needs the DirectXTK\inc directory in the "Additional Include Paths" settings with the 'releative path'

See <http://blogs.msdn.com/b/vcblog/archive/2010/05/03/flexible-project-to-project-references.aspx>

 

We are actually working on some bonifide samples, but for now this works.

Jun 22, 2012 at 5:31 PM

I tried the steps from a new project and got:

error C1192: #using failed on 'C:\<blah><blah>\DirectXTK\Bin\Metro\Win32\Debug\DirectXTK.winmd'

When I double click the error, it takes me to the pch.cpp for DirectXTK

Maybe something changed between VS 11 Beta and VS 12 RC

I'm using VS Ultimate 2012 RC.  Version 11.0.50522.1 RCREL

Thanks, Doug Mair

Coordinator
Jun 22, 2012 at 10:13 PM

#using is for WinRT assemblies, but DirectXTK is a native C++ static lib.  You should be linking with the .lib file and #including the .h, no #using statement involved.

Jun 25, 2012 at 7:50 AM

I see the same problem. So I referenced and put include path as mentioned. But I run into the winmd problem. So I manually included the .lib in linker-input settings (I see no point in referencing the project then - expect as a build dependency). I still see same winmd problem.  Does VS2012 project automatically assume its winrt component when we reference a project ? how do you "tell" it the referenced project is just a plain native lib. 

Coordinator
Jul 5, 2012 at 9:21 PM

DirectXTK is a static library, not a WinRT assembly.  So you must set "Copy Local = False", "Reference Assembly Output = False" and "Link Library Dependencies = True" in the Build Properties for that project reference.