gameprogcpp / code

Game Programming in C++ Code
Other
1.01k stars 354 forks source link

Memory.h file missing + 486 other errors? #30

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi Sanjay, I have just started chapter two of your book. I downloaded your code for chapter 2 and opened it in Visual Studio 2017 on Windows 10; It is failing to build because the include memory is underlined red and the png files can’t be seen. In the error box there are also 486 other errors relating to missing header files. I have got all the required C++ workloads installed and up to date SDK, I have had no issues with any other projects I have run. Any ideas? Thanks, Mike.

ghost commented 5 years ago

Ok just an update. I have managed to get it down to 9 errors, all of which are C1010 Did you forget to add include “stdafx.h” to your source? All I done was install an older version of SDK. Thanks, Mike

chalonverse commented 5 years ago

I'm not sure why you'd get that error, because Precompiled Headers are disabled for the project, which means it shouldn't be looking for stdafx.h. Can you verify the "Not Using Precompiled Headers" option is set as in https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1010?view=vs-2019

ghost commented 5 years ago

Hi Sanjay, I have been reading up about it at work and I think I might of enabled that option when I was trying to get the other problem sorted. I will check when I finish work tomorrow. Fingers crossed it will compile as I am really enjoying your book.

ghost commented 5 years ago

Hi Sanjay, Your chapter two code is up and running. Thank you for your help.

Just a quick question. What would I do if I wanted to make a game using the latest version of SDK as memory.h wasn’t recognised, is there now an alternative? Thanks, Mike.

chalonverse commented 5 years ago

Yeah, so in Visual Studio 2017, you can update the SDK version to whatever the latest one is and it will work fine. In 2019 they've added an option in project files to just say "latest Windows 10 SDK" which then fixes the problem of the version number changing every couple of months.

The code all does work in Visual Studio 2019, so you could certainly upgrade the project files to that and it would work also. However, I wanted to maintain backwards compatibility on this repo so I haven't updated the projects to 2019 yet. But maybe it's worthwhile to update them and just tell people to install 2019 now.