原来是一个控制台程序,我新建了一个空的mfc application exe(dialog)工程,并且严格按照原来工程的路径把所有的文件都添加到source files 和header files里,结果compile能通过,但build老出现unexpected end of file while looking for precompiled header directive错误??怎么半???

解决方案 »

  1.   

    在前面加一句:#include "stdafx.h"
      

  2.   

    Alt-F7翻到 C/C++页,Category选择:Precompiled Headers左边选择stdafx.cpp, 右边设为:Create Precompiled Header File(.pch) 
                                 Through header: StdAfx.h左边选择其他的cpp文件,右边设为:Use procompiled header file(.pch)
                                     Through header: StdAfx.h
      

  3.   

    在你的.cpp文件的最开头的位置上添加#include "stdafx.h"
      

  4.   

    最好的方法是不使用precompiled header file,因为你是从console程序转过来的,估计没有使用MFC。设置可以在project settings中进行,很简单的。