我有一个程序,我现在加一个公用函数文档到项目中,出现如下错误,请问是什么原因。function.h如下
#if !defined(public_function_h)
#define public_function_h  
   void ReadtoList(CListCtrl *p,CString sql);
#endif
function.cpp如下
#include "function.h"
void ReadtoList(CListCtrl *p,CString sql);
{
  AfxMessageBox("has Called");
}它会出现如下错误,这是什么原因
unexpected end of file while looking for precompiled header directive

解决方案 »

  1.   

    void ReadtoList(CListCtrl *p,CString sql);这里结尾不应该有分号再看看括号有没有配上对。
      

  2.   


    function.cpp如下#include "stdafx.h"             //add mfc must#include "function.h"
    void ReadtoList(CListCtrl *p,CString sql)
    {
      AfxMessageBox("has Called");
    }
      

  3.   

    我想应该是设置问题
    试修改project->settings->C/C++在category中选择Precompiled Headers
    然后将Automatic use of compiled headers选中
    确定
    然后重新完全编译工程
      

  4.   

    结贴,加上#include "stdafx.h"就OK。