question

DeadStack avatar image
0 Votes"
DeadStack asked RLWA32-6355 answered

Cannot open precompiled headers

I made a Windows Desktop Application in C++, I have two projects and I'm getting errors

Cannot open precompiled header file: 'x64\Debug\BehaviourDemo.pch':No such file or directory.

137104-usepch.png




And maybe related. It's unclear what template I should be using for modern desktop apps. I think this one had stdfx or something as the header. I think it was Windows Desktop Application. And my library was the static library - I then changed it to dynamic library. I just deleted all that code and replaced it. Is that an issue?

Edit: After posting this, it made me think that I should just redo the projects, so I used the DirectX Win32 project and the DLL project types instead. That may have fixed the issue.

c++
usepch.png (3.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RLWA32-6355 avatar image
1 Vote"
RLWA32-6355 answered

The VS2019 Windows Desktop Application template is not configured to use precompiled headers. I suggest that instead, you use the Windows Desktop Wizard.

137050-wdw.png

After clicking "Create" make the following selections -

137017-wdp.png

The wizard will then create a solution/project that is properly configured to use precompiled headers.



wdw.png (26.8 KiB)
wdp.png (11.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.