Handmade Hero » Forums » Code » Need help with Visual Studio insanity
Cipherpunk
Christopher McLaughlin
3 posts
#13438 Need help with Visual Studio insanity
1 week, 4 days ago

I'm really struggling to solve a VS problem. Some of my included header files cannot be opened inside VS even though the code compiles just fine. I'm getting an error that says windows.h is not found in the build paths. How can I add a header to the path? VS deprecated the ability to change the include paths but I also can't change them from inside the project because Handmade Hero is just a dummy solution and the option is missing from the properties page. Anybody have ideas?
mmozeiko
Mārtiņš Možeiko
1502 posts
1 project
#13441 Need help with Visual Studio insanity
1 week, 4 days ago Edited by Mārtiņš Možeiko on Nov. 7, 2017, 7:52 a.m.

Are you using VS only for debugging, not compiling? If that's so then what do you mean by "header files cannot be opened"? File -> Open -> File doesn't work? What exactly happens if you select open file menu item?
Cipherpunk
Christopher McLaughlin
3 posts
#13443 Need help with Visual Studio insanity
1 week, 3 days ago

Correct, I am only using VS for debugging. When I right click on the #include <windows.h> there's an option to open the file. But whenever I do this, it creates an error popup that says Windows cannot find this header file in my current directory or build paths. It then gives me a list of the paths it checked for the header file.
ratchetfreak
314 posts
#13444 Need help with Visual Studio insanity
1 week, 3 days ago

isn't there also a button to look for it then?
Cipherpunk
Christopher McLaughlin
3 posts
#13445 Need help with Visual Studio insanity
1 week, 3 days ago

There is not. The popup dialog cannot be interacted with in any way.
mrmixer
Simon Anciaux
283 posts
#13447 Need help with Visual Studio insanity
1 week, 3 days ago

I've got the same result on VS2017 (installed last week). If I use VS2012 I don't have that problem.

I have several paths that contains windows.h but none that match what's in the popup.

C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\um\Windows.h
C:\Program Files (x86)\Windows Kits\8.0\Include\um\Windows.h
C:\Program Files (x86)\Microsoft Keyboard Layout Creator 1.4\inc\Windows.h
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include\Windows.h

I don't know if it's related but when passing file to open to VS2017 (devenv test.exe .\lib\lib.h .\lib\abc.h ...) I often get a message that say that some of the files couldn't be opened (if I relaunch I have the message but with different files, or sometimes it works...). The files are present and I never get that problem with VS2012.
mmozeiko
Mārtiņš Možeiko
1502 posts
1 project
#13450 Need help with Visual Studio insanity
1 week, 3 days ago

Yes, this is also my experience. If you don't have normal VS project for building, then during debugging intellisense features don't work well. And when they work then it depends on current moon phase.

The best way to debug is to open file manually and then read it or put breakpoints.
mrmixer
Simon Anciaux
283 posts
#13457 Need help with Visual Studio insanity
1 week, 2 days ago Edited by Simon Anciaux on Nov. 8, 2017, 12:45 p.m. Reason: typo

Passing /useenv as an argument to devenv seems to fix the windows.h problem for me.