1,错误:“fatal error C1010: unexpected end of file while looking for precompiled header directive”
解决方案 :2种解决方案:(1),一个新添加的类的.cpp文件开头没包含stdafx.h,在该文件最前面加上即可
(2),可以使用右键点击项目工程中的该cpp文件,选择setting,在c/c++栏,选择PreCompiled headers,然后设置第一选项,选择不使用预编译头,解决这个问题
2、这一段时间要用到dll中使用ado,在mfc中用ado一段时间没有出现什么问题,本以为在dll中也不会出现什么问题,但是问题产生了,而且是在最开始的导入ado的dll文件时候。我的做法是:
#import "c:/program files/common files/system/ado/msado15.dll" no_namespace rename("EOF","adoEOF")
出现:
Compiling resources...
Compiling...
StdAfx.cpp
F:/source/vc/Query/debug/msado15.tlh(169) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(212) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(256) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(277) : error C2011: 'EditModeEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(285) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
F:/source/vc/Query/debug/msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
F:/source/vc/Query/debug/msado15.tlh(527) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.
ADIDllTest.dll - 6 error(s), 1 warning(s)
后来经过在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")
相对来说,还是第一种方法显得更加简便。
3、用VS2005编写的程序,发布时却出现了“由于应用程序的配置不正确,应用程序未能启动,重新安装应用程序可能会纠正这个问题”。在网上查了很多解决方案,但是下面的解决方案最好:
第一步,什么设置都不用改,什么静态链接还是动态链接都不管了,什么多线程调试什么多线程也不管了,就用默认的配置属性。
第二步,找到你要发布的程序,COPY出来,相关度的资源也COPY到恰当的位置。
第三步,找到D:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT下面的四个文件,三个dll,一个manifest文件。。。我这里用2008来说,2005就自己推。。。,COPY他们四个到你的程序目录下面。
第四步,准备一个辅助包,
Visual Studio 2008的用户下这个:
http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe
Visual Studio 2005 sp1的用户下这个:
http://download.microsoft.com/download/7/9/8/798325b7-8993-4ef9-9148-8db9ff4187fc/vcredist_x86.exe
然后也放在你的程序目录下面。
第五步,拷贝这些所有东西到目标机器上,然后先安装第四步下载的玩意,再运行你的程序,Over。。。
4、IE8 与 VS2005 冲突问题解决方法
问题表现为:
MFC类向导添加类时,出现“当前页面的脚本发生错误”,进入MFC类向导后上方有一个小黄条“此网站的某个加载项运行失败。请检查'Internet选项'中的安全设置是否存在潜在冲突”,基类下拉框无项值,无法成功添加MFC类。
针对这一问题解决办法是:
添加一注册表项:
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones
如果不存在1000这一项的话,首先添加;在此项(1000)中添加一个DWORD值
名称为1207,类型为REG_WORD, 数据为0x00000000,即可解决问题。
希望以后遇到类似问题的朋友可以给你们一些帮助