夢想飛翔

          自強不息
          posts - 111, comments - 30, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          在編譯VC++6.0是,出現(xiàn)fatal error C1010: unexpected end of file while looking for precompiled header directive
          的錯誤.

          解決方法:

          1、如果發(fā)生錯誤的文件是由其他的C代碼文件添加進入當前工程而引起的,則Alt+F7進入當前工程的 Settings,選擇C/C++選項卡,從Category組合框中選中Precompiled Headers,選擇Not Using Precompiled headers。確定。

          2、在文件開頭添加:
          #include "stdafx.h"

          對預編譯頭文件說明如下:  
             
          所謂頭文件預編譯,就是把一個工程(Project)中使用的一些MFC標準頭文件(如Windows.H、Afxwin.H)預先編譯,以后該工程編譯時,不再編譯這部分頭文件,僅僅使用預編譯的結果。這樣可以加快編譯速度,節(jié)省時間。  
             
          預編譯頭文件通過編譯stdafx.cpp生成,以工程名命名,由于預編譯的頭文件的后綴是“pch”,所以編譯結果文件是projectname.pch。  
             
          編譯器通過一個頭文件stdafx.h來使用預編譯頭文件。stdafx.h這個頭文件名是可以在project的編譯設置里指定的。編譯器認為,所有在指令#include   "stdafx.h"前的代碼都是預編譯的,它跳過#include   "stdafx.   h"指令,使用projectname.pch編譯這條指令之后的所有代碼。  
             
          因此,所有的CPP實現(xiàn)文件第一條語句都是:#include   "stdafx.h"。   


          評論

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2009-07-02 23:27 by Annlimiya
          謝謝~~
          幫了我大忙

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive[未登錄]  回復  更多評論   

          2010-06-24 11:18 by 小林
          感謝,幫我我一個大忙

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2010-07-14 10:12 by yao yongjie
          謝謝,今天又學了點東西

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2010-07-21 14:51 by 張倩
          非常感謝

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2010-09-14 23:34 by ah
          上大學長?

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2010-09-18 22:09 by gmz
          c:\program files\microsoft visual studio\myprojects\12\1222.cpp(2) : fatal error C1083: Cannot open precompiled header file: 'Debug/12.pch': No such file or directory
          執(zhí)行 cl.exe 時出錯.
          是什么問題啊 按照上面的方法不管用啊

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2010-09-18 22:16 by gmz
          #include <iostream>
          #include <stdafx.h>
          using namespace std;
          unsigned fac(unsigned n)
          { unsigned f;
          if(n==0)
          f=1;
          else
          f=fac(n-1)*n;
          return f;
          }


          int main()
          { unsigned n;
          cout<<"enter a number:";
          cin>>n;
          unsigned y=fac(n);
          cout<<n<<"!="<<y<<endl;
          return 0;
          }
          編譯時提醒
          c:\program files\microsoft visual studio\myprojects\12\1222.cpp(2) : fatal error C1083: Cannot open precompiled header file: 'Debug/12.pch': No such file or directory
          執(zhí)行 cl.exe 時出錯.
          高手幫幫忙

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2011-03-24 11:43 by lang4612
          我也是如此喔!@gmz

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2011-03-27 15:00 by xjq
          確實幫了我的大忙啊 呵呵~~ 謝謝 lz

          # re: fatal error C1010: unexpected end of file while looking for precompiled header directive[未登錄]  回復  更多評論   

          2011-04-09 13:40 by wang
          真的非常謝謝!

          # d:\vc6en\myprojects\p\0000.cpp(27) : fatal error C1010: unexpected end of file while looking for precompiled header directive  回復  更多評論   

          2011-10-09 22:06 by Brandy
          d:\vc6en\myprojects\ : fatal error C1010: unexpected end of file while looking for precompiled header directive
          Error executing cl.exe. 如何消除

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 阳山县| 辉县市| 衡阳市| 靖安县| 泸西县| 广汉市| 平度市| 都匀市| 高雄县| 永安市| 城步| 五河县| 万安县| 淳化县| 娄烦县| 腾冲县| 博湖县| 饶阳县| 临江市| 镇江市| 临桂县| 扶绥县| 四会市| 天台县| 新乡县| 余姚市| 马边| 荆门市| 临颍县| 四平市| 邢台市| 平塘县| 贵港市| 乡宁县| 安陆市| 肃宁县| 江门市| 龙州县| 芷江| 城步| 台北市|