error C2871: “ADODB”: 具有该名称的命名空间不存在(error C2871: “ADODB”: 具有该名称的命名空间不存在)
2015-04-08 15:24
288 查看
1.WINDOWS.H already included. MFC apps must not #include <windows.h>
I just added the #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","ADOEOF")
in the <StdAfx.h> file. When the import sentence was add in the head of file,the error occured. But when I moved it to the tail of the file,Everything was OK. I don't know why.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
//#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF") ////error
#if !defined(AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_)
#define AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","ADOEOF") ////is OK
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_)
2error C2011: 'DataTypeEnum' : 'enum' type redefinition解决方法
2009-06-26 17:36
I just added the #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","ADOEOF")
in the <StdAfx.h> file. When the import sentence was add in the head of file,the error occured. But when I moved it to the tail of the file,Everything was OK. I don't know why.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
//#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF") ////error
#if !defined(AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_)
#define AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","ADOEOF") ////is OK
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C914C8D4_56EB_44CD_AE77_600C6D941BA2__INCLUDED_)
2error C2011: 'DataTypeEnum' : 'enum' type redefinition解决方法
2009-06-26 17:36
1>------ 已启动生成: 项目: iotser, 配置: Debug Win32 ------ 1>正在编译... 1>iotser.cpp 1>f:\c++ pro\iocptser\debug\msado15.tlh(228) : error C2011: “LockTypeEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(109) : 参见“LockTypeEnum”的声明 1>f:\c++ pro\iocptser\debug\msado15.tlh(276) : error C2011: “DataTypeEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(138) : 参见“DataTypeEnum”的声明 1>f:\c++ pro\iocptser\debug\msado15.tlh(321) : error C2011: “FieldAttributeEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(127) : 参见“FieldAttributeEnum”的声明 1>f:\c++ pro\iocptser\debug\msado15.tlh(343) : error C2011: “EditModeEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(83) : 参见“EditModeEnum”的声明 1>f:\c++ pro\iocptser\debug\msado15.tlh(352) : error C2011: “RecordStatusEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(341) : 参见“RecordStatusEnum”的声明 1>f:\c++ pro\iocptser\debug\msado15.tlh(616) : error C2011: “ParameterDirectionEnum”: “enum”类型重定义 1> c:\program files\microsoft sdks\windows\v6.0a\include\dbdaoint.h(326) : 参见“ParameterDirectionEnum”的声明 1>f:\c++ pro\iocptser\iocptser.cpp(18) : error C2871: “ADODB”: 具有该名称的命名空间不存在 1>生成日志保存在“file://f:\C++ pro\iocptser\Debug\BuildLog.htm” 1>iocptser - 7 个错误,0 个警告 ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ========== 后来经过在csdn上的搜索发现有下面两种办法来解决这个问题 1) #pragma warning(disable:4146) #import "C:\Program Files\Common Files\System\ADO\msado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF") #pragma warning(default:4146) using namespace ADODB; 2) #pragma warning(disable:4146) #import "C:\Program Files\Common Files\System\ado\msado15.dll" \ no_namespace \ rename("EOF","adoEOF") rename("DataTypeEnum","adoDataTypeEnum") \ rename("FieldAttributeEnum", "adoFielAttributeEnum") rename("EditModeEnum", "adoEditModeEnum") \ rename("LockTypeEnum", "adoLockTypeEnum") rename("RecordStatusEnum", "adoRecordStatusEnum") \ rename("ParameterDirectionEnum", "adoParameterDirectionEnum") |
相关文章推荐
- error C2871: “cv”: 具有该名称的命名空间不存在 解决思路
- error C2871: “System”: 具有该名称的命名空间不存在
- error C2871: “System”: 具有该名称的命名空间不存在
- error C2871: “System”: 具有该名称的命名空间不存在 的解决办法
- error C2871: “std”: 具有该名称的命名空间不存在 解决方法
- error C2871: “cv”: 具有该名称的命名空间不存在
- error C2871: “System”: 具有该名称的命名空间不存在 的解决办法
- error C2871: “std”: 具有该名称的命名空间不存在
- “std”: 具有该名称的命名空间不存在
- 从vc到使用vs 的一些改变(“std”: 具有该名称的命名空间不存在; msvcp90.dll丢失)
- 错误“std”: 具有该名称的命名空间不存在”
- VS C# 命名空间 “ ”中不存在类型或命名空间名称 “ ” 。是否缺少程序集引用?
- 命名空间 “” 中不存在类型或命名空间名称 解决
- CS0234: 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)
- 【Url编码问题】命名空间“System.Web”中不存在类型或命名空间名称“HttpUtility”。是否缺少程序集引用?
- 命名空间“Microsoft.Office”中不存在类型或命名空间名称“Interop”。是否缺少程序集引用?
- “System.Web”中不存在类型或命名空间名称“Optimization”
- 命名空间“System.Web”中不存在类型或命名空间名称“Script”(是缺少程序集引用吗?)
- 命名空间“Microsoft.Office.Interop.Word”中不存在类型或命名空间名称“WdExportFormat”
- 命名空间“Microsoft office”中不存在类型或命名空间名称“Interop”