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. CArray Question

CArray Question

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++help
3 Posts 2 Posters 7 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.
  • M Offline
    M Offline
    Matt Gates
    wrote on last edited by
    #1

    In my .h file I am declaring a CArray like so: CArray m_Array; I get the following complaints from C++.NET many times over: error C2143: syntax error : missing ';' before '<' error C2238: unexpected token(s) preceding ';' error C2501: 'CDerivedDialogBarView::CArray' : missing storage-class or type specifiers I have checked around this site and others and can't seem to put this together. Surely this is a beginners mistake or something. Suggestions? TIA. Matt (Padawan Learner)

    C 1 Reply Last reply
    0
    • M Matt Gates

      In my .h file I am declaring a CArray like so: CArray m_Array; I get the following complaints from C++.NET many times over: error C2143: syntax error : missing ';' before '<' error C2238: unexpected token(s) preceding ';' error C2501: 'CDerivedDialogBarView::CArray' : missing storage-class or type specifiers I have checked around this site and others and can't seem to put this together. Surely this is a beginners mistake or something. Suggestions? TIA. Matt (Padawan Learner)

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      i can't if you are using CArray incorrectly or if you're using the CP boards incorrectly :) don't take that as an insult - i'll explain: CArray is a template class. you can't just declare a CArray, you have to declare a CArray of some object type:

      // important
      #include < afxtempl.h>

      // declaration
      CArray < myType, myType& > m_Array;

      the CP comment was because CP's boards will eat < tags if you're not careful, so i couldn't tell if you had template params or if the board ate them :) oh yeah, and std::vector is a better array in nearly all respects. -c


      Image tools: ThumbNailer, Bobber, TIFFAssembler

      M 1 Reply Last reply
      0
      • C Chris Losinger

        i can't if you are using CArray incorrectly or if you're using the CP boards incorrectly :) don't take that as an insult - i'll explain: CArray is a template class. you can't just declare a CArray, you have to declare a CArray of some object type:

        // important
        #include < afxtempl.h>

        // declaration
        CArray < myType, myType& > m_Array;

        the CP comment was because CP's boards will eat < tags if you're not careful, so i couldn't tell if you had template params or if the board ate them :) oh yeah, and std::vector is a better array in nearly all respects. -c


        Image tools: ThumbNailer, Bobber, TIFFAssembler

        M Offline
        M Offline
        Matt Gates
        wrote on last edited by
        #3

        My bad.:laugh: I was missing the #include < afxtempl.h> Thanks. It's been a long day(or night).

        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