Click here to Skip to main content
15,895,740 members
Articles / Programming Languages / C++
Tip/Trick

*.pch file missing!

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
15 Feb 2010CPOL 43.3K   2   9
Sometimes, Visual c++ users see a pretty confusing error message when they compile or build their projects. the error message says :fatal error C1083: Cannot open precompiled header file: 'filename.pch': No such file or directorymy solution was :In VS, go to Project->Options, set the...
Sometimes, Visual c++ users see a pretty confusing error message when they compile or build their projects. the error message says :

MSIL
fatal error C1083: Cannot open precompiled header file: 'filename.pch': No such file or directory


my solution was :

MSIL
In VS, go to Project->Options, set the Configuration Combobox in top to 'All Configurations', and then from left pan, choose 'C/C++->Precompiled Haeders' and set 'Create/Use Precompiled headers' option to value : 'Create Precompiled headers (/Yc)'.


which turned out not to be an accurate solution (Read the Messages below).

well, here is the solution :


1) Right click on the PROJECT (in Solution Explorer) | Properties | C/C++ | Pre-compiled Headers... here you set to ** /Yu **
2) Right click on STDAFX.CPP (in Solution Explorer) | Properties | C/C++ | Pre-compiled Headers... here you set to ** /Yc **

its done.

all credits for this tip goes to :SledgeHammer01

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWorked For Me! Thank You !!!!!!!!!!!!!!!!!+! Pin
Member 912601929-Mar-17 14:26
Member 912601929-Mar-17 14:26 
GeneralMy vote of 1 Pin
SledgeHammer0114-Feb-10 8:06
SledgeHammer0114-Feb-10 8:06 
GeneralRe: My vote of 1 [modified] Pin
The Zetta14-Feb-10 9:39
The Zetta14-Feb-10 9:39 
GeneralRe: My vote of 1 Pin
SledgeHammer0114-Feb-10 10:57
SledgeHammer0114-Feb-10 10:57 
GeneralRe: My vote of 1 Pin
The Zetta14-Feb-10 21:24
The Zetta14-Feb-10 21:24 
GeneralRe: My vote of 1 Pin
SledgeHammer0115-Feb-10 7:13
SledgeHammer0115-Feb-10 7:13 
GeneralRe: My vote of 1 Pin
The Zetta15-Feb-10 8:34
The Zetta15-Feb-10 8:34 
I completely understand the things you say.

Ok, lets face it another way! how would you do the second part of your own solution?

how would you set settings for stdfx.cpp to /Yc ?

my tip is wrong? so be it! I' not afraid of that (not at all! I'm surprised to see that expression! Smile | :) ) ), and your rating does not matter at all! Smile | :) ) I assumed my solution will help people for this problem, it wont? prove it to me (probably its good to refrence to msdn , etc) and I'll change that, saying your name and giving all credits to you Smile | :) ) come on! we're here to help each other not to get ranking!!!

I'm a C# developer basically, and during a C++ project, encountered the error, so, searched in web, and hardly find the above solution. so, thought putting this on code project will be good for the next person who donno what to do!

So, explain it please.
GeneralRe: My vote of 1 Pin
SledgeHammer0115-Feb-10 8:40
SledgeHammer0115-Feb-10 8:40 
GeneralRe: My vote of 1 Pin
The Zetta15-Feb-10 21:31
The Zetta15-Feb-10 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.