Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rebuild precompiled header

I am trying to use MFC with ProC.
Functions.pc is where I do the ProC syntax to connect to the database. So I include the 'Functions.h' in the dialog model where I want to call the functions in 'Funtions.h'. And now I got this error.

    Add directive to 'stdafx.h' or rebuild precompiled header

I understand that I need to include 'stdafx.h' to 'Functions.h' for it to work. And I did that. It can compile,but then when I try to run the program,it won't recognize the syntax of ProC created by the 'Functions.cpp' created. I don't really understand how to rebuild the precompiled header since I don't understand the codes in 'stdafx.h'.

like image 604
Azuan Avatar asked Nov 06 '11 19:11

Azuan


People also ask

Can I choose not to use precompiled headers?

You can choose to not use precompiled headers, and you can specify the header file name and the name and path of the output file. Custom precompiled code For large projects that take significant time to build, you may want to consider creating custom precompiled files.

What is the purpose of a precompiled header file?

The purpose of the file is to speed up the build process. Any stable header files, for example Standard Library headers such as <vector>, should be included here. The precompiled header is compiled only when it, or any files it includes, are modified.

What is a precompiled header (PCH)?

Your program comprises multiple modules, all of which use a standard set of include files and the same compilation options. In this case, all include files can be precompiled into one precompiled header. The first compilation — the one that creates the precompiled header (PCH) file — takes a bit longer than subsequent compilations.

What is the structure of a makefile that uses a precompiled header?

Structure of a Makefile That Uses a Precompiled Header File Beginning at the top of the diagram, both STABLEHDRS and BOUNDRY are NMAKE macros in which you list files not likely to need recompilation. These files are compiled by the command string CL /c /W3 /Yc$(BOUNDRY) applib.cpp myapp.cpp


2 Answers

Within VS 2012 you can set the properties of the Project, the Solution, or Source File(s) to not use Precompiled Headers. See attached graphic for how to do it... VS Turn off Precompiled Headers

like image 151
Kirk Avatar answered Sep 28 '22 10:09

Kirk


Found the solution myself. I need to set the properties of that .cpp file to not using any pre-compiled header.

like image 45
Azuan Avatar answered Sep 28 '22 10:09

Azuan