Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, November 14, 2017 11:51 AM | 1 vote
I migrated to a new Win10 Enterprise computer. After a new install of VS2017 Pro (v15.4.3), building my solution (which builds fine on the 2017 install on the old computer), generates this error:
c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.11.25503\atlmfc\include\afx.h(62): fatal error C1083: Cannot open include file: 'new.h': No such file or directory
And there were many other of the "standard" libraries similarly flagged.
The solution file is comprised of a large number of c++ projects representing MFC DLL's, libs, and standalone exe's which use MBCS versus Unicode.
Running the "Repair" option from Visual Studio Installer did not fix it.
I think I've solved this before, and it has something to do with the SDK, but I can't remember what I did to fix it. Any guidance appreciated.
Update: I resolved the issue by running the Visual Studio Installer on the working system and taking a screen snapshot of the options selected. When I made the options match on the new system, mostly this involved unchecking the box for Universal Windows Platform development, our code built. Unfortunately, it isn't obvious why this option is apparently the wrong option.
rhfritz
All replies (6)
Wednesday, November 15, 2017 5:58 AM
Hi rhfritz,
Thank you for the update.
Glad to hear that you solved this successfully, It's really kind of you for sharing such a good solution.
Have a good day :)
Best Regards,
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Monday, October 15, 2018 8:38 AM
new.h used to live in an include folder of the vc compiler and now is located in the SDK folder (for example C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt). Make sure to add this in your include section and it should compile fine.
Monday, October 15, 2018 11:08 PM
I've never had to manually add VS Dependencies directly to my projects before. That's usually handled by VS via macros, environment variables, etc. While explicitly adding that would work, it would break the fact that the my solutions / projects generally have not changed as we've migrated VS versions. The vcxproj files themselves are modified by VS as part of the upgrade process.
In all likelihood, the fix was that a proper SDK path was brought in by my selections.
rhfritz
Friday, January 17, 2020 6:40 PM
In case anyone is interested, I had a similar issue, although in my case the error was:
c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\cstddef(7):
fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
I was able to resolve it as follows: Re-execute the VS 2017 installer, go to Individual Components and check "VC++ 2015.3 v14.00 (v140) toolset for desktop"
Tuesday, January 21, 2020 4:16 AM
Interesting. But why would installing the Visual C++ 2015 toolset suddenly get stddef.h to work with the 2017 toolset. This file is not part of the Visual C++ 2015 toolset install and Visual C++ 2017 wouldn't be checking any of the 2015 paths.
My bet is that you didn't select the Windows SDK when you installed Visual Studio 2017 and installing 2015 managed to force it to automatically select an option which installed the Windows 10 SDK (the UCRT SDK is part of the Windows 10 SDK) and this got things working. Either that or the installer failed to install the Windows SDK the first time through and just the act of installing the second C++ toolset caused it to recheck things and reinstalled the Windows SDK.
This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.
Monday, March 30, 2020 2:55 PM
Someone else was interested ;) Thanks a lot! I couldn't figure out what the problem was - following your simple tip above worked magic for me!
Pelle