各位:
   我的程序在debug下编译一切正常,但在release下编译出错:
错误信息:
1、fatal error C1010: unexpected end of file while looking for precompiled header directive
2、error C2509: 'GetDocument' : member function not declared in 'CMyListView'
  第二个错误总是指向.h中的:
   #ifndef _DEBUG            // debug version in viewgrid.cpp
    inline CTreeListDoc* CMyListView::GetDocument()
      { return (CTreeListDoc*)m_pDocument; }
   #endif
   我实在没辙了,请大家帮忙!!!!先谢谢了!

解决方案 »

  1.   

    你去掉预编译头文件选项试一试....
    http://www.codetools.com/debug/releasemode.asp看一看也许有帮助
      

  2.   

    我看了一下CMyListView中确实没有GetDocument()函数,但这两行是系统自己生成的呀,
      

  3.   

    简单办法:将.cpp中的GetDocument()移到.h的类申明中,而且它本来就是一个inline函数。.h变成这样:class CTreeListDoc;
    class CMyListView
    {
      ...
      #ifndef _DEBUG         
          CTreeListDoc* CMyListView::GetDocument()
          { return (CTreeListDoc*)m_pDocument; }
      #endif
    };
      

  4.   

    sorry,应该是:class CTreeListDoc;
    class CMyListView
    {
      ...
      #ifndef _DEBUG         
          CTreeListDoc* GetDocument()
          { return (CTreeListDoc*)m_pDocument; }
      #endif
    };
      

  5.   

    谢谢各位,我按照“zhuyie”的做法,编译通过了,但LINK时出了很多错误,
    我想我该放弃VC了,这个东东真是害死人啦,学JAVA去吧。
        再一次对各位的帮助表示感谢!!!
      

  6.   

    把 “#ifndef _DEBUG“ 和 “#endif"去掉, 试试,那是条件编译指令。Release时_DEBUG没有定义。
      

  7.   

    对不起,看错了,预编译指令不用去掉,(如果去掉,在Debug版中编译也不能通过了),
    你可以试试将下面的语句:
     #ifndef _DEBUG            // debug version in viewgrid.cpp
        inline CTreeListDoc* CMyListView::GetDocument()
          { return (CTreeListDoc*)m_pDocument; }
     #endif
    挪到CMyListView类的定义中。或在CMyListView类的定义中加入下面的语句:
     #ifndef _DEBUG            // debug version in viewgrid.cpp
        inline CTreeListDoc* GetDocument();
     #endif
    另外,学JAVA可以,但是你就保证在JAVA中不会遇到类似的问题么?
      

  8.   

    建议自己重载GetDocument函数,
    另外,你的这个CMyListView是继承自那个类?