???????????????
????????????????????????????VS 2005?????????????????TestInc???????м????????
????MyMath.h????????£?
????#pragma once
????double acos(double Num);
????MyMath.cpp????????£?
????double acos(double Num)
????{
????return 1.0;
????}
????TestInc.cpp????????£?
????#include "TestInc.h"
????#include <stdio.h>
????#include <math.h>
????int _tmain(int argc?? _TCHAR* argv[])
????{
????double a = acos(0.5);
????return 0;
????}
??????????????
????1>c:program filesmicrosoft visualstudio 8vcincludemath.h(107) : error C2732: ????淶??“acos”??????淶???
????1>       c:program filesmicrosoft visual studio 8vcincludemath.h(107) : ?μ?“acos”??????
??????????TestInc.cpp?????????????????
????#include <stdio.h>
????#include <math.h>
????#include "TestInc.h"
?????????????????????????main???????????C?????????acos????????????????????????????????????????????????acos????????????(???TestInc.h?????????????????????????????????????)??
?????????С???????ó???????????Google C++ ????????????C++????????????????????????????????Google C++ ????????????????????????????????????????C++?????????????????????????????????????????????????????????
????????????????е????????
??????Visual Studio??????????????????????cpp??????????stdafx.h?????????????????????????λ??????????????????????
???????Visual Studio????????????????????????????????????????????????ν???????????????????е?????????????????÷??????????????????.pch???????????????????????????????Щ?????????????????κε?C/C++??????????inline????????????????????????????????????в???????????????Щ????????????????±???????????????????????????????????????????????????????????????????????6- 7M????????????Щ?????????????????
???????????????????????????Time stamp???????????????????????????????????????Щ??????????????????????????Щ????α??????????????б????????????????????????????????????????????????????????????????λ?????????????????????????±???????????????????????????????????????е??????.eg Macro?? Preprocessor ????????′?????顣 VC????????????????????????????????????ζ?????′?????Щ??????
?????????????????????????????????????????????????????????б????ζ???????Щ????????????????????????????????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????.pch ??????????????StdAfx.h?????????????????????VC???????“??????”????????????????????????????????????????????κ???????????????????????????AppWizard?????MFC Dialog Based???????????????????????AppWizard???????????????????????????????????StdAfx.h??????VC??????????????????????????????????μ???????
????#include <afxext.h> // MFC extensions
????#include <afxdisp.h> // MFC Automation classes
????#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
????#include <afxcmn.h>
??????Щ???????MFC??????????????????????????????????????????????Щ????????????????????????
???????????????????????????????????????????????????????????????????????????cpp?????????.pch ?????????????????StdAfx.cpp????????????????????????#include“Stdafx.h”???????????????????????????????????????D?D?D????????????????.cpp??????????????????/Yc???????????StdAfx.cpp?????????.pch????????/Fp ????????????????pch????????????project ->Setting->C/C++ ???????Category???Precompiled Header?????????????????????????????Project Options(??????????????)??????? /Fp “debug/PCH.pch”??????????????.pch????????????????????.pch??????????????????????? StdAfx.cpp??????????Project Option????? Source File Option??????????????????????????????????????????????????? /Yc?????/Yc??????????????????????????Pch?????/Yc?????????????????????????????????????????????????????????????? YC?????VC??????????? StdAfx.cpp????????Obj????????PCH?????
?????????????????ú????????????????????????????????????????????????????????
????1??????????/Yu????????????????????????.cpp??????????????????????pch?????.h??????????stdafx.h????????????????????а?????????????????Unexpected file end.
????2????????pch?????С??????????????????????????????????????pch????????????????stdafx.cpp???????/Yc?????cpp????????±????????????
?????????Linux????????????????????????????У???????????????Linux????GCC??????????????????????????????IDE CodeBlocks??CodeBlocks??????GCC?????????????????????Linux????????
???????CodeBlocks?????C++??????????????my_pch.h?????????′???
/***************************************************************
* Name:      my_pch.h
* Purpose:   Header to create Pre-Compiled Header (PCH)
* Author:     ()
* Created:   2010-10-26
* Copyright:  ()
* License:
* ??÷???: ??????????-->???????-->????????????
-Winvalid-pch
-include my_pch.h
**************************************************************/
#ifndef MY_PCH_H_INCLUDED
#define MY_PCH_H_INCLUDED
// put here all your rarely-changing header files
#include <iostream>
#include <string>
#endif
???????????????????–>???????–>????????????
????-Winvalid-pch
????-include my_pch.h
???????????????????????
??????? main.cpp ??????? include ???????????????????????
????int main()
????{
????using namespace std;
????cout << "Hello world!" << endl;
????return 0;
????}
?????????????????д????????У???????????????
????#include <iostream>