Compile error

Discussion in 'Questions (Windows Mobile)' started by enonod, May 28, 2008.

  1. enonod

    enonod Well-Known Member Licensed User

    V.6.30, optimised compile, device.exe.

    The error is...
    error CS0178: invalid rank specifier: expected ',' or ']'

    The program runs on the desktop. I removed ' _' line splitters but still have the problem.
    The line is...

    Code:
    cwData()= Array   ((191,17+1,90),(191,207,180),(49+1,207,270), _
       (
    49+1,33+1,0),(175,33+1,90),(175,191,180),(65+1,191,270),(65+1,49+1,0), _
       (
    159,49+1,90),(159,175,180),(81+1,175,270),(81+1,65+1,0),(143,65+1,90), _
       (
    143,159,180),(97+1,159,270),(97+1,81+1,0),(127,81+1,90),(127,143,180), _
       (
    49+1,143,270),(49+1,17+1,0))
    Any pointers please?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should declare cwData as a 2d array:
    Code:
    Sub Globals
        
    Dim cwdata(0,0)
    End Sub

    Sub App_Start
        cwData()= 
    Array    ((191,17+1,90),(191,207,180),(49+1,207,270) , _ 
        (
    49+1,33+1,0),(175,33+1,90),(175,191,180),(65+1,191,270),(65+1,49+1,0), _
        (
    159,49+1,90),(159,175,180),(81+1,175,270),(81+1,65+1,0),(143,65+1,90), _
        (
    143,159,180),(97+1,159,270),(97+1,81+1,0),(127,81+1,90),(127,143,180), _
        (
    49+1,143,270),(49+1,17+1,0))
    End Sub
     
  3. enonod

    enonod Well-Known Member Licensed User

    This is my Dim line, sorry I didn't include it in the post. It does run on desktop!

    Dim Type(X,Y,D) cwData(20,3)

    [EDIT] If I turn off optimise it compiles, but I don't really understand the requirements for optimise.
    I have formlib and sprite libs in the same folder, surely I don't have to copy the lib source to the folder do I?
     
    Last edited: May 28, 2008
  4. enonod

    enonod Well-Known Member Licensed User

    I have tried everything and cannot solve this.
    I note that 'rank specifier refers in c# to arrays and uses [], I also note the error message uses ']'.
    As I said, it runs on desktop and compiles without optimization.

    I have no knowledge of c#, but does this all indicate a possible clue to a problem in the source for a Lib regarding the new Array command?
     
  5. agraham

    agraham Expert Licensed User

    You don't need to specify the extra dimension for a Type, the Type specifier does that for you. Try "Dim Type(X,Y,D) cwData(20)"
     
  6. enonod

    enonod Well-Known Member Licensed User

    Why is it always something not obvious but simple?
    My thanks agraham.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice