AllahIsGreat

Hi,

... ... ... I'm using the Vidual C++ Compiler... I have a PRECOMPILED HEADER FILE... I just don't know how to make it part of my programs... How do I instruction the Visual C++ Compiler to include and use the Precompiled Header File so that I won't have to go over all the codes all over again... I think if it's a Precompiled Header File, it's probably a whole bunch of the codes that I've got in my other header files... So, How EXACTLY do I make it used in my programs .cpp ... Suppose I have a PRECOMPILED HEADER FILE called yodingdond.pch ... Then, How do I tell the Compiler to use yodingdong.pch when building and compiling my .cpp file...



Re: Visual C++ Language How do we use and include PRECOMPILED HEADER FILES in our codes... .cpp or .h ...? Anybody...?

Sdi

If you're compiling from the command it's the /Yu option; if you're using the IDE, it's a property on the .CPP source file; which version of Vistual Studio are you using



Re: Visual C++ Language How do we use and include PRECOMPILED HEADER FILES in our codes... .cpp or .h ...? Anybody...?

AllahIsGreat

Hi,

... ... ... Listen... I'm using the Visual Studio 2005 Standard Edition Visual C++ 2005 Compiler... I don't know what is the IDE or the command whatever... All I know is that I'd create a C++ Win 32 Empty Project... Then, I'd create a .cpp main program file and use the #include comand to include a .h header file... However, instead of using a .h Header file, I'd like to be able to use the Precompiled header file instead... So, from the Empty Project .cpp file, How do I include the Precompiled Header Header file... I've tried to type /Yu and name of Precompiled Header File... But the compiler does not recognize the command... It's just from the Project, I press Alt, the B for Build menu, the B for Build... Now, if you know, then what is the EXACT line of code that's needed... What does it look like...





Re: Visual C++ Language How do we use and include PRECOMPILED HEADER FILES in our codes... .cpp or .h ...? Anybody...?

Simple Samples

A precompiled header does not replace headers; a precompiled header file is a temporary file. If a precompiled header file is deleted, it will be recreated from the header files. The only purpose of a precompiled header is for efficiency; the compiler processes header files up to a point, which is determined by options, then the compiler saves the result of that initial processing so that it does not need to do the processing again. The intent is that the result of processing only header files that are rarely or never changed are saved in the pch file. You still must have the headers in your source code. A precompiled header file does nothing except make compiling faster.

I suggest creating a project that is not just an empty project. After creating it, build it without any modifications. Test it to ensure it works; it should. The project will be generated so that precompiled headers are used properly. Then you can either modify the source files and otehr things in the project or you can use the project as an example of what to do. The thing you don't want to do is to get impatient with people tyring to help you. You need to read more of the documentation instead of getting impatient, otherwise people will get impatient with you and they simply won't help.






Re: Visual C++ Language How do we use and include PRECOMPILED HEADER FILES in our codes... .cpp or .h ...? Anybody...?

sunil_singhal_10e2aa

why don't you create a library for that code as we do in C or c++.
just place that code without main() in new file & compile it without linking.
then make a header file where you should declare all the functions which you have defined in the previous compiled file.
then you can include this header file in any code.
i hope this might solve your problem