请教高手:
我用的是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 我对此错误不知道指什么,请高手帮我分析下,谢谢!
我用的是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 我对此错误不知道指什么,请高手帮我分析下,谢谢!
解决方案 »
- MFC richedit控件,如何显示彩色文字和行号?
- 完成端口WSASend的数据缓冲区什么时候释放?
- 用ado连接access,如何将一个access文件的表全部复制到另一个access文件中?
- VC已经是昨日黄花??
- 执行<<深入浅出MFC>>源代码的一个问题?
- 夜风微凉兄.请进
- 什么情况把消息加入Doc类,什么情况把加入View类,什么时候加入MainFrame类?
- 请教各位高手 怎样做一个能发送和接受fax的程序(急!急!!急!!!)
- 示波器显示空件:
- MFC下,怎么删除FlexGrid控件一个单元格中的数据
- [菜鸟问题]想要操作Excel需要添加什么头文件吗?
- 问一个关于GetCommandLine函数的问题
我包含了<new>之后,还是提示错误。我是这样包含的:
#include <new>
#include <vector>
using namespace std;
这样还是不行。
支持VC6的Microsoft SDK更新,好象现在没有了。有没有最后支持VC的SDK更新版本号,或者VC能兼容的SDK.再次谢谢你的关注。
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
我没有放在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中声明,那我头文件中就不能使用吧?
一模一样,所有症状.你把#include <vector>放在stdafx.h,再Rebuild All,试试.
我这样一放,问题解决.