Compile error

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

B4X:
   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?
 

Erel

Administrator
Staff member
Licensed User
You should declare cwData as a 2d array:
B4X:
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
 

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:

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?
 

enonod

Well-Known Member
Licensed User
Why is it always something not obvious but simple?
My thanks agraham.
 
Top