Cannot open precompiled header file: 'StdAfx.pch': No such file or directory

Keep Open and Learning
Post Reply
星际浪子
Posts: 3597
Joined: 01 May 2009 23:45

Cannot open precompiled header file: 'StdAfx.pch': No such file or directory

Post by 星际浪子 » 18 Aug 2011 13:48

StdAfx.cpp(6): fatal error C1083: Cannot open precompiled header file: 'x64\Debug\StdAfx.pch': No such file or directory"

Please make sure the Precompiled Header option of stdafx.cpp is “Create (/Yc)” and the Precompiled Header option of project (rest of CPP files) is “Use (/Yu)”.

We can access the project’s Precompiled Header option via Project properties pages -> Configuration Properties -> C/C++ -> Precompiled Headers -> Precompiled Header.

We can access the stdafx.cpp’s Precompiled Header option by right click on stdafx.cpp in Solution Explorer, click Property, it will open a properties pages for stdafx.cpp. We need to navigate to Configuration Properties -> C/C++ -> Precompiled Headers -> Precompiled Header.

Post Reply