有文件1.h 1.cpp 2.cpp
          但在编译时候1.cpp文件出现错误
          unexpected end of file while looking for precompiled header    directive
          1.h文件在另外一个文件2.cpp中包含(2.cpp中用到1.cpp中的函数).  
           在工程中将1.cpp复制到2.cpp中前面,将1.h, 1.cpp 文

解决方案 »

  1.   

    刚才有几行字没复制进去.
     
              有文件1.h 1.cpp 2.cpp
              但在编译时候1.cpp文件出现错误
              unexpected end of file while looking for precompiled header directive
              1.h文件在另外一个文件2.cpp中包含(2.cpp中用到1.cpp中的函数).  
               在工程中将1.cpp复制到2.cpp中前面,将1.h, 1.cpp 文件从工程中删除就可以了.
      

  2.   

    unexpected end of file while looking for precompiled header    请加上:
    #include "stdafx.h"
      

  3.   

    #include <stdafx.h>
    加在出错的文件中,就应该没问题了
      

  4.   


       不是 末尾是不是少了#endif ,这我加上去了!
       果然是少了#include <stdafx.h> , 一加上去就没问题啦.
       多谢大家的帮助!