如何解决错误C2668:'ATL :: inlineisequalunknown':对重载函数的模糊调用 [英] How to solve error C2668: 'ATL::inlineisequalunknown' : ambiguous call to overloaded function
问题描述
我正在使用Visual Studio 2008并且我想使用CRegKey类
因为我只包含文件atlbase.h并且在编译后我收到以下错误
我没有使用过该文件的任何地方我只是包含文件并编译它就是它
错误1错误C2668:'ATL :: InlineIsEqualUnknown':对重载函数的模糊调用C:\Program Files(x86)\ Mysoftoft Visual Studio 9.0 \ VCC \ atmfc\include\atlbase.inl 254
我尝试过:
I'm using Visual studio 2008 and I want to use CRegKey class
for that I just include the file atlbase.h and after compile I'm getting following error
I have not used anything anywhere from that file I just included file and compiled that's it
Error 1 error C2668: 'ATL::InlineIsEqualUnknown' : ambiguous call to overloaded function C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlbase.inl 254
What I have tried:
#include "afxwin.h"
#include "Student.h"
#include "Teacher.h"
#include "Settings.h"
#include "About.h"
#include "BaseDlg.h"
#include "Label.h"
#include "XPButton.h"
//Here I included the atlbase.h file if i remove this statement then error is not coming
#include "atlbase.h"
推荐答案
你标记了你的问题w ith MFC。然后默认情况下使用预编译的头文件,其中包括 stdafx.h 。
所以我猜你忘了包含 stdafx。 h 在源文件中。
然后 stdafx.h 很可能已经包含 atlbase.h (直接使用包含声明或间接通过其他文件)。因为您的文件在源文件中不包含 atlbase.h 时编译时没有错误,所以这里就是这种情况(否则会出现有关未知标识符的错误)。
我不太确定究竟发生了什么,但忘记包含该文件会产生很多副作用。
另请注意 afxwin .h 也已包含在 stdafx.h 中。因此,源文件的顶部应如下所示:
You tagged your question with MFC. Then precompiled headers are used by default which requires including stdafx.h.
So I guess that you forgot to include stdafx.h in your source file.
Then stdafx.h very likely includes atlbase.h already (directly with an include statement or indirectly by other files). Because your files compile without error when not including atlbase.h in the source files this will be the case here (otherwise there would be errors about unknown identifiers).
I'm not quite sure what really happened but forgetting to include that file can have many side effects.
Note also that afxwin.h is also already included by stdafx.h. So the top of your source file should look like:
// Include stdafx.h on top of all source files
// before including any other file
#include "stdafx.h"
#include "Student.h"
#include "Teacher.h"
#include "Settings.h"
#include "About.h"
#include "BaseDlg.h"
#include "Label.h"
#include "XPButton.h"
// ATL and MFC system header files (afx*.h, atl*.h) should be included by stdafx.h
这篇关于如何解决错误C2668:'ATL :: inlineisequalunknown':对重载函数的模糊调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!