Sign in to follow this  

beginning directx 11 game programming - The example won't run. I'm using Visual Studio 2015

This topic is 402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all. My first post :). It's not of the kind that I wished my first post would be of.

 

So I'm trying to run the examples from this book. The code won't run though and i'm getting a bunch of errors. Is there something I can do so that the code from this book can run. Shouldn't it run right from the start?

 

My background on programming is as you might guess it. A beginner really hence me looking up this book.

 

All I've done to the example is made sure the include and library is pointed to the right location in VC++ directories. This took away a few anomaly's i feel but the code won't run.

 

I've attached a screenshot of the errors i'm getting.

 

If anyone might know how I can get the examples running i'd be most grateful. Thank you very much.

Share this post


Link to post
Share on other sites

It seems your project can't locate Windows.h (it is red underlining).

Create new Win32 project, and compare paths and general settings between your DX project and win32 reference project.

 

Thank you. I shall try this as soon as i can get round too. Hopefully i can get the example running today :)

 

Anymore more suggestions are welcome too of course.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

Oh welcome!

 

So you did find the "include" files in Windows explorer as well, did you? I.e. can you click on let's say windows.h? This isn't really clear from your post, or is the file physically missing?

 

Can you see if you have the "Windows SDK" installed? It should've been selected when you run the installer,

https://www.reddit.com/r/windows/comments/44vq8j/does_visual_studio_2015_update_1_includes_full/

Share this post


Link to post
Share on other sites

Oh welcome!

 

So you did find the "include" files in Windows explorer as well, did you? I.e. can you click on let's say windows.h? This isn't really clear from your post, or is the file physically missing?

 

Can you see if you have the "Windows SDK" installed? It should've been selected when you run the installer,

https://www.reddit.com/r/windows/comments/44vq8j/does_visual_studio_2015_update_1_includes_full/

 

Thank you for the welcome and replying. I haven't got round to anything as been bit occupied today. I will see if I can carryout what has been recommended to me in the posts here. I'll keep people in the loop. Thanks for the post again Dim_Yimma_H :).

Share this post


Link to post
Share on other sites

Oh welcome!

 

So you did find the "include" files in Windows explorer as well, did you? I.e. can you click on let's say windows.h? This isn't really clear from your post, or is the file physically missing?

 

Can you see if you have the "Windows SDK" installed? It should've been selected when you run the installer,

https://www.reddit.com/r/windows/comments/44vq8j/does_visual_studio_2015_update_1_includes_full/

 

So when i installed VS'15 as my hard drive space is abit low I didn't do a full install. I would of like to have done but i think it said 40gb was needed and I just don't have that right now unfortunately. Now this evening i went back into them settings through going into the setup and 'modify'. It may appear that I hadn't installed the sdk for my OS (windows 10) so I am installing them now as I write this. We shall see how the code runs after this is complete.

Thanks for pointing this bit out to me. I'll keep this thread updated in the hope I can eventually get this example running. At the time of making the book I think the author used VS'13 also which may have a small part to play in this but we'll see what happens after I have some sdk's installed. I can't believe I missed installing them first time round really as I'm aware they are quite important.

Share this post


Link to post
Share on other sites

The header (windows.h) file should be located in your C:\Program Files (x86)\Windows Kits\10\Include\um\ directory.

 

Btw aren't the Windows Kits included with the OS (independent of Visual Studio)?

 

thanks for the reply. most helpful


i will be getting to the bottom of this soon today. By evening time i should have carried out what has been advised. Last night i tried installing sdk's from setup modify. MOstw ere installed but it sprouted an error and apparently a computer restart was needed to fix the error message upon installation. Now its a new day my computer has restarted after being off last night. So the installations should go off without a hitch. WiIl keep you lot posted

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

You can also take a look at the Microsoft tutorials hosted at Github and explained in more depth at MSDN.

The code will be very similar to (but probably more neat and to-the-point than?) the code you are using now.

 

Thanks. I've looked at them links and have now a Github account. I was needing to make one and now I've done this. I am familiar with that msdn tutorial actually also. Thanks for the link all the same


I'm about to post a screenshot of what i'm upto regarding my issue still. Will be up soon.

Share this post


Link to post
Share on other sites

So i tried this last night. The error can be resolved by restarting the computer apparently. But after trying again today I get the same message.

I'm thinking of uninstalling VS'15 and installing again with the options selected in the first place.

 

When i installed first time round VS'15 i was wary of the space I had so couldn't do a full install. I might be paying for that now ^^.

 

So, if anyone would like to reply I'd be most grateful. Thanks. I haven't been too active with this issue over last day or so but this evening am looking to work this out. Just want the code to run.

 

Also. When i went into modify last night I hadn't had any of the sdk's installed so i have 2 of the 3 installed now so that's new. The code still won't run though.


It seems your project can't locate Windows.h (it is red underlining).

Create new Win32 project, and compare paths and general settings between your DX project and win32 reference project.

 

i will try this now

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

no sign of windows.h in the example i'm running. Can anyone guide me at all please. Sorry. I am a bit of a noob with all this.

I'm on a Coding course that hopefully will get me into the games industry. If this forum can help me along the way i'd be very happy. Thanks for any help anyone can offer me. Ty.

Share this post


Link to post
Share on other sites
no sign of windows.h in the example i'm running

Windows.h - is a system header.

It lives in C:\Program Files (x86)\Windows Kits\...

It should not be in example folder.

 

Try to search from this folder for this file.

Probably it will be in C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0 or C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0

 

 

1. Do you have some similar "Included Directories"?

On top of that, this book uses "DXSDK_10" SDK.

It is from days when DirectX was not part of Visual Studio.

So you need NOT to delete SDK-related paths from your project configuration.

 

If you have not installed the SDK, you need to download it and install.

Link

Edited by Happy SDE

Share this post


Link to post
Share on other sites

ill carryout what the last 2 posts have said. 1 moment please.

 

@Happy. Do i need to add include <windows.h> into my code do you think then? < edit - i realise now this might not make much sense, its already in some code. I meant do i need to put it in the header area somewhere?


I have Microsoft DirectX SDK (June 2010) installed in on my PC also

 

I found windows.h in C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0

 

So i went into properties of the project. Clicked on vc++ directories. include. Here I added the directory for the windows.h. After running the issue still remains.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

Would anyone in this forum be able to help me get this example working if possible please. It's just a little frustrating. This book 'beginning directx 11 game programming' examples I would of thought that'd work from the start but i can't run the examples. Maybe because i'm using a different Visual Studio that they made the examples in I do not know. Just annoying how I can't run the code so I can learn directx.

Please if anyone can help me i'd be most grateful. It is just so frustrating.

 

The screenshot is just something i tried recently. Due to the error cannot open include file windows.h. I am trying whatever I can to try resolve this.


Can i ask. If i can find the header file in my c: . What do I then do from here? Again, I am not brilliant at coding yet so may need to be walked through possibly.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

@matt. Hi, just looking at your post now. I will see. 1 moment

 

in that screenshot just above. After i added that include directory it popped up in the evaluated value also.

 

I run the code and still it won't work :( .

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

Ok, I decided to make my hands dirty. :)

Here is a step-by-step fix:

 

1. [optional]Retarget your project to existing Windows SDK:

Right button on a project in solution explorer, “Retarget SDK version”. Choose one of installed on your computer.

 

2. Fix Project paths: Right click on project => Properties. In dialog: Configuration properties => VC++Directories.

 

2.1. Set Include directories:

$(DXSDK_DIR)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);

 

2.2. Set library directories:

$(DXSDK_DIR)Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86

 

3. If you will have compilation error like this:

unresolved external symbol __vsnprintf referenced in function "long __stdcall StringVPrintfWorkerA(char *,unsigned int,unsigned int *,char const *,char *)" (?StringVPrintfWorkerA@@YGJPADIPAIPBD0@Z)

 

Add

int (WINAPIV * __vsnprintf)(char *, size_t, const char*, va_list) = _vsnprintf;

after

#include"CubeDemo.h"

You can find the project here:

https://www.dropbox.com/s/x4j3h4fjoqb16o5/3DCube.zip?dl=0

This link will be valid till 2016.12.02

Edited by Happy SDE

Share this post


Link to post
Share on other sites

If you have not installed the SDK, you need to download it and install.

 

Link

 

 

 

 

 

In my opinion, it is not good to download obsolete headers and libraries.

For instance: d3dx9.hd3dx10.h and d3dx11.h are deprecated.

 

Currently d3d11_2.h and d3dcompiler.h suffice for me to get started.

 

P.S.: I do not say get rid of the older platforms and APIs at once, but rather stay on the non-obsolete path while learning.

Share this post


Link to post
Share on other sites

"Starting with Windows 8, the DirectX SDK is included as part of the Windows SDK."

 

The SDK is not really obsolete. if you are developing on windows 7 you have to download it. Also if you want to use d3dx you will need to download it. even if it is "deprecated", older code can still use them since the code may have been written while it was not deprecated. You can always go through and update the deprecated or obsolete stuff, but some people have work to do

Share this post


Link to post
Share on other sites

"Starting with Windows 8, the DirectX SDK is included as part of the Windows SDK."

 

The SDK is not really obsolete. if you are developing on windows 7 you have to download it. Also if you want to use d3dx you will need to download it. even if it is "deprecated", older code can still use them since the code may have been written while it was not deprecated. You can always go through and update the deprecated or obsolete stuff, but some people have work to do

 

I am not against downloading obsolete code on your machine, since some software, you use, will probably download it anyway as is often the case with DirectX and .NET.

I am only a bit sceptical of downloading obsolete frameworks with the purpose of starting to learn the framework.

Edited by matt77hias

Share this post


Link to post
Share on other sites

This topic is 402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this