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. Managed C++/CLI
  4. C++/CLI Array problem

C++/CLI Array problem

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpdata-structuresbeta-testingquestion
9 Posts 4 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.
  • B Offline
    B Offline
    Brian Olej
    wrote on last edited by
    #1

    I'm using the new Visual C++ Express beta and when I try to compile a file containing this code: int fileLength = binRead->ToString()->Length; array^ sendFile = gcnew array(fileLength); I get the following errors: error C2065: 'array' : undeclared identifier error C2275: 'System::Byte' : illegal use of this type as an expression stdafx.cpp : see declaration of 'System::Byte' error C2065: 'sendFile' : undeclared identifier error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?) error C2061: syntax error : identifier 'array' From several articles i've read it seemed to me as though I was declaring the array in the proper manner, however can anyone give me a hand with this? Could the error possibly be elsewhere in my code? [Edit]I know when declaring native arrays the length must be a constant, is that also the case with C++/CLI Arrays?

    P B 2 Replies Last reply
    0
    • B Brian Olej

      I'm using the new Visual C++ Express beta and when I try to compile a file containing this code: int fileLength = binRead->ToString()->Length; array^ sendFile = gcnew array(fileLength); I get the following errors: error C2065: 'array' : undeclared identifier error C2275: 'System::Byte' : illegal use of this type as an expression stdafx.cpp : see declaration of 'System::Byte' error C2065: 'sendFile' : undeclared identifier error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?) error C2061: syntax error : identifier 'array' From several articles i've read it seemed to me as though I was declaring the array in the proper manner, however can anyone give me a hand with this? Could the error possibly be elsewhere in my code? [Edit]I know when declaring native arrays the length must be a constant, is that also the case with C++/CLI Arrays?

      P Offline
      P Offline
      palbano
      wrote on last edited by
      #2

      BrianOlej wrote: error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?) If the compiler does not recognize that operator it might indicate that you do not of the project configured properly for managed extensions.

      "No matter where you go, there your are." - Buckaroo Banzai

      -pete

      B 1 Reply Last reply
      0
      • P palbano

        BrianOlej wrote: error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?) If the compiler does not recognize that operator it might indicate that you do not of the project configured properly for managed extensions.

        "No matter where you go, there your are." - Buckaroo Banzai

        -pete

        B Offline
        B Offline
        Brian Olej
        wrote on last edited by
        #3

        I would have to have rethought my entire life if that was the problem. Naw, when I comment out the arrays the rest of the managed code compiles fine. Signature under construction.

        P 1 Reply Last reply
        0
        • B Brian Olej

          I would have to have rethought my entire life if that was the problem. Naw, when I comment out the arrays the rest of the managed code compiles fine. Signature under construction.

          P Offline
          P Offline
          palbano
          wrote on last edited by
          #4

          Sorry. Shot in the dark... missed everything and hit myself in the head :((

          "No matter where you go, there your are." - Buckaroo Banzai

          -pete

          1 Reply Last reply
          0
          • B Brian Olej

            I'm using the new Visual C++ Express beta and when I try to compile a file containing this code: int fileLength = binRead->ToString()->Length; array^ sendFile = gcnew array(fileLength); I get the following errors: error C2065: 'array' : undeclared identifier error C2275: 'System::Byte' : illegal use of this type as an expression stdafx.cpp : see declaration of 'System::Byte' error C2065: 'sendFile' : undeclared identifier error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?) error C2061: syntax error : identifier 'array' From several articles i've read it seemed to me as though I was declaring the array in the proper manner, however can anyone give me a hand with this? Could the error possibly be elsewhere in my code? [Edit]I know when declaring native arrays the length must be a constant, is that also the case with C++/CLI Arrays?

            B Offline
            B Offline
            Bo Hunter
            wrote on last edited by
            #5

            #using using namespace stdcli::language; That may help. Thank You Bo Hunter

            B 1 Reply Last reply
            0
            • B Bo Hunter

              #using using namespace stdcli::language; That may help. Thank You Bo Hunter

              B Offline
              B Offline
              Brian Olej
              wrote on last edited by
              #6

              Perfect! Thank you, it solved my problem. Signature under construction.

              C 1 Reply Last reply
              0
              • B Brian Olej

                Perfect! Thank you, it solved my problem. Signature under construction.

                C Offline
                C Offline
                cppmanuf
                wrote on last edited by
                #7

                Interesting..I thought that was automatically imported for every /clr build. Maybe not in beta 1, I guess. Matt

                B B 2 Replies Last reply
                0
                • C cppmanuf

                  Interesting..I thought that was automatically imported for every /clr build. Maybe not in beta 1, I guess. Matt

                  B Offline
                  B Offline
                  Brian Olej
                  wrote on last edited by
                  #8

                  Yeah, I thought so as well, I guess not. Signature under construction.

                  1 Reply Last reply
                  0
                  • C cppmanuf

                    Interesting..I thought that was automatically imported for every /clr build. Maybe not in beta 1, I guess. Matt

                    B Offline
                    B Offline
                    Bo Hunter
                    wrote on last edited by
                    #9

                    I believe mscorlib.dll is the only automatic import, but I have been wrong before. Thank You Bo Hunter

                    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