Problem converting project from VC6 to VC8
-
Hello, in a subproject,while compiling a cpp file which includes afximpl.h, I'm getting the following error message: c:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\..\\src\\mfc\\afximpl.h(734) : error C2976: 'CArray' : too few template arguments The error is caused by a class CVariantBoolConverter, also in afximpl.h:
class CVariantBoolConverter { protected: CArray'<'CVariantBoolPair> m_boolArgs; public: ...
As CArray is forward declared in afx.h astemplate'<'class TYPE, class ARG_TYPE> class CArray;
C2976 occurs because of the missing ARG_TYPE argument in the CVariantBoolConverter declaration. So far so good... but when I dig deeper to the original declaration of CArray in afxtempl.h:template'<'class TYPE, class ARG_TYPE = const TYPE&> class CArray : public CObject { public: // Construction CArray(); ...
ARG_TYPE is suddenly optional! This is clearly a mismatch between the forward and real declaration of CArray, but the question is why am I the only one wich seems to be having problems with this bug? We already have successfully converted other projects using templates without errors in my company, and I can't find anyone via Google or Usenet who is having the same or a similar problem. Since I'm completely :confused: and X| now I hope someone can shed a ray of light on this... adTHANKSvance, Skarrin -
Hello, in a subproject,while compiling a cpp file which includes afximpl.h, I'm getting the following error message: c:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\..\\src\\mfc\\afximpl.h(734) : error C2976: 'CArray' : too few template arguments The error is caused by a class CVariantBoolConverter, also in afximpl.h:
class CVariantBoolConverter { protected: CArray'<'CVariantBoolPair> m_boolArgs; public: ...
As CArray is forward declared in afx.h astemplate'<'class TYPE, class ARG_TYPE> class CArray;
C2976 occurs because of the missing ARG_TYPE argument in the CVariantBoolConverter declaration. So far so good... but when I dig deeper to the original declaration of CArray in afxtempl.h:template'<'class TYPE, class ARG_TYPE = const TYPE&> class CArray : public CObject { public: // Construction CArray(); ...
ARG_TYPE is suddenly optional! This is clearly a mismatch between the forward and real declaration of CArray, but the question is why am I the only one wich seems to be having problems with this bug? We already have successfully converted other projects using templates without errors in my company, and I can't find anyone via Google or Usenet who is having the same or a similar problem. Since I'm completely :confused: and X| now I hope someone can shed a ray of light on this... adTHANKSvance, SkarrinI thought CArray always had two args ? I guess it's too late to convert this code to standard C++, but for future reference, using the standard containers ( such as vector ), would insulate you from these sort of issues.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I thought CArray always had two args ? I guess it's too late to convert this code to standard C++, but for future reference, using the standard containers ( such as vector ), would insulate you from these sort of issues.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
I thought CArray always had two args ? I guess it's too late to convert this code to standard C++, but for future reference, using the standard containers ( such as vector ), would insulate you from these sort of issues.
The code snippets I posted are all located in Microsofts very own header files :rolleyes:. The cgraph.cpp file which causes the error does not use any template classes itself, it just includes afximpl.h because it calls other functions like AfxGetFileTitle defined there. (In case anyone knows it, the subproject making trouble is an old commercial product called "Graphics Server 5" from "Bits Per Second Ltd.", which we last upgraded before 2000 :-O ). Regards, Skarrin
-
Hello, in a subproject,while compiling a cpp file which includes afximpl.h, I'm getting the following error message: c:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\..\\src\\mfc\\afximpl.h(734) : error C2976: 'CArray' : too few template arguments The error is caused by a class CVariantBoolConverter, also in afximpl.h:
class CVariantBoolConverter { protected: CArray'<'CVariantBoolPair> m_boolArgs; public: ...
As CArray is forward declared in afx.h astemplate'<'class TYPE, class ARG_TYPE> class CArray;
C2976 occurs because of the missing ARG_TYPE argument in the CVariantBoolConverter declaration. So far so good... but when I dig deeper to the original declaration of CArray in afxtempl.h:template'<'class TYPE, class ARG_TYPE = const TYPE&> class CArray : public CObject { public: // Construction CArray(); ...
ARG_TYPE is suddenly optional! This is clearly a mismatch between the forward and real declaration of CArray, but the question is why am I the only one wich seems to be having problems with this bug? We already have successfully converted other projects using templates without errors in my company, and I can't find anyone via Google or Usenet who is having the same or a similar problem. Since I'm completely :confused: and X| now I hope someone can shed a ray of light on this... adTHANKSvance, SkarrinIt works fine for me, even using the default (omitting the) 2nd template parameter. Some things to check: Make sure afxtempl.h is included before trying to define a CArray class. Make sure the TYPE used in the definition is defined before trying to define a CArray class using that type. Mark
"Go that way, really fast. If something gets in your way, turn."