我用ADO写了一个上传,下载图像到数据库的代码,应用程序已经测试通过我试着把它编译成DLL时,出现了这样的问题:File -> New ->Project(MFC AppWizard(DLL)我在stdafx.h中加入这两行:
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "ADOEOF")
#include "ole2.h"其它代码还没写,编译出现如下问题:c:\...\msado15.tlh(143) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(184) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(228) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(245) : error C2011: 'EditModeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(253) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
c:\...\msado15.tlh(432) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.2.dll - 6 error(s), 0 warning(s)
这是为什么?
谢谢!
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "ADOEOF")
#include "ole2.h"其它代码还没写,编译出现如下问题:c:\...\msado15.tlh(143) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(184) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(228) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(245) : error C2011: 'EditModeEnum' : 'enum' type redefinition
c:\...\msado15.tlh(253) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
c:\...\msado15.tlh(432) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.2.dll - 6 error(s), 0 warning(s)
这是为什么?
谢谢!
解决方案 »
- 微软用什么开发工具?
- C/S同机测试正常,局域网内两台机器测试时失败???
- 写不动程序的时候,大家都转到那方向去拉??
- 超级高手进来帮忙急~~~~~
- 让messagebox或afxMessagebox弹出在最上边
- 请教:typedef std::vector<OPPoint> PointList;什么意思啊
- 请问怎么样判断一个char类型的内容是不是都是数字?
- 使用CList时遇到一个奇怪问题,大家来看看是什么原因!
- MFC的問題,請高手幫幫忙!
- 50分买“我爱背单词2000”序列号表!谢谢!!!
- 谁有使用Tree控件的代码,给粘一点来,谢谢!马上给分!
- VC生成的PE格式可执行文件最小能到几K?有人说2K以下?
不要放在stdafx.h中
别的文件中,还是再现同样的问题。高手发言啊!谢过各位了!
union S; // Error C2011
解决办法:在stdafx.h中开始处加入
#pragma onceSpecifies that the file will be included (opened) only once by the compiler in a build. This can reduce build times as the compiler will not open and read the file after the first #include of the module.For example,// header.h
#pragma once
这样的错误。怎么搞定它?
改成这样
#import "C:\Program Files\common files\system\ado\msado15.dll" rename_namespace("AdoNS") rename("EOF","adoEOF")using namespace AdoNS;
你试着改换嵌入文件的位置,删除一些不必的include文件.就是这样.或着找个例程,对校一下这个头文件.