请教高手:
   我用的是VC++6.0。先看下代码
 #if !defined(AFX_PAGE4_H__35A2252E_4D6E_45F2_98CB_85324DAC6482__INCLUDED_)
#define AFX_PAGE4_H__35A2252E_4D6E_45F2_98CB_85324DAC6482__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Page4.h : header file
//
#include <vector>
using namespace std;
/////////////////////////////////////////////////////////////////////////
// CPage4 dialog
class CPage4 : public CDialog
{
// Construction
public:
CPage4(CWnd* pParent = NULL);   // standard constructor
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPage4)
protected:
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
//}}AFX_VIRTUAL
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PAGE4_H__35A2252E_4D6E_45F2_98CB_85324DAC6482__INCLUDED_) 我重载了CDialog类,希望得到自己的对话框,我想在新的对话框中使用vector容器来管理一些数据,但当我包含<vector>时,出现以下错误,请高手帮我分析下:
Compiling...
MainFrm.cpp
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl op
erator new(void))(unsigned int)'
        c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(41) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,void *)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl operator new(void))(unsig
ned int)'
        c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2065: '_P' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\memory(16) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2784: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' : could not deduce template argument for 'void *(__cdecl *)(u
nsigned int,class std::allocator<_Ty> &)' from 'void *(__cdecl *)(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2785: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' and 'void *(__cdecl *__cdecl operator new(void))(unsigned int
)' have different return types
        c:\program files\microsoft visual studio\vc98\include\memory(16) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\memory(20) : error C2954: template definitions cannot nest   我对此错误不知道指什么,请高手帮我分析下,谢谢!

解决方案 »

  1.   

    Hi yjgx007:
       我包含了<new>之后,还是提示错误。我是这样包含的:
       #include <new>
       #include <vector>
       using namespace std;
       这样还是不行。
      

  2.   

    Hi yigx007:
       支持VC6的Microsoft SDK更新,好象现在没有了。有没有最后支持VC的SDK更新版本号,或者VC能兼容的SDK.再次谢谢你的关注。
      

  3.   

    又发现个现象,上面的编译模式是在Debug模式,如果我选择Release模式时却没有以上错误提示,
      

  4.   

    你的 #include<...> 一定是放在cpp文件中的这段代码的后面了,把 #include<...> 提到这段代码的前面去就行了,看看这段代码的意思就知道它在debug版重载了new操作符。#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
      

  5.   

    Hi lemon_wei:
       我没有放在cpp文件中啊,我放在h头文件中,你看下代码:#if !defined(AFX_PAGE4_H__35A2252E_4D6E_45F2_98CB_85324DAC6482__INCLUDED_)
    #define AFX_PAGE4_H__35A2252E_4D6E_45F2_98CB_85324DAC6482__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // Page4.h : header file
    //
    #include <vector>
    using namespace std;
    /////////////////////////////////////////////////////////////////////////
    // CPage4 dialog
    class CPage4 : public CDialog
    {
      .....
    };   因为我想在CPage4中使用Vector容器,保存一串数据。如果我在cpp中声明,那我头文件中就不能使用吧?
      

  6.   

    我遇到了你同样的错误.
    一模一样,所有症状.你把#include <vector>放在stdafx.h,再Rebuild All,试试.
    我这样一放,问题解决.