我在一个MFC的程序里直接加入纯C的文件(一个C和一个H文件),在编译时就出现unexpected end of file while looking for precompiled header directive。需要怎么做才能在最小改动的情况下把C的函数直接用在MFC里呢?

解决方案 »

  1.   

    在文件的最开始添加
    #include "stdafx.h"
    再试试
      

  2.   

    project -->setting -->c/c++ -->category -->Precompiled Headers --> 选择 Not using precompiled headers 选中要加入的c文件。
      

  3.   

    #include "*.cpp"
    不要包含*.h
      

  4.   

    同意http://expert.csdn.net/Expert/topic/2255/2255262.xml?temp=.230755
      

  5.   

    加入stdafx.h
    还要把自己的文件连接到.app中
      

  6.   

    重复一下!project -->setting -->c/c++ -->category -->Precompiled Headers --> 选择 Not using precompiled headers 选中要加入的c文件。