Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem converting project from VC6 to VC8

Problem converting project from VC6 to VC8

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++questioncsharpvisual-studio
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Skarrin
    wrote on last edited by
    #1

    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 as template'<'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

    C M 2 Replies Last reply
    0
    • S 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 as template'<'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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      S 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        S Offline
        S Offline
        Skarrin
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S 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 as template'<'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

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          It 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."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups