Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot convert expression type to symbol
#1
I have this sample code:

  Common Shared Test() As String * 260

which in the status area displays

  Cannot convert expression type to symbol

and I had to drill down to the function declaration using process of elimination to find.

Problem: the error does not state the line number it is in!

could this be fixed in a future mod of Qb64??

Thanks, Erik.
Reply
#2
Is there a reason that you are using COMMON? Are you chaining programs together? If not you could use:

Code: (Select All)
DIM Shared Test() As String * 260
Reply
#3
Cannot use empty braces with "DIM", the compiler has to know the extent of the array. Avoid using "CHAIN" and "COMMON" in QB64PE. It worked well with "BRUN45" module but this is not the late 1980's anymore.
Reply
#4
COMMON SHARED was also used back in the QJurassic Era when you needed to pass variables to modules in multi-modular programs. Using multi-modular programming allowed for more than the 64K single module limit. I think I used to pull about 220K with that method. Note because memory was and still is allocated for different processes unevenly, it was darn near impossible to write a program that would end up being 256K.

Anyway, back to the point. Yes, whenever possible a line number should be reported by the IDE. Steve, when he is feeling better, or Matt may want to have a look at adding line number recognition.

Also, even with DIM SHARED, we have to define the elements in the array...

DIM SHARED test(100) AS STRING * 256

or ...
DIM SHARED test(0) AS STRING * 256

...and

REDIM test(100) ' Sometime later.

Unfortunately, arrays were not able to be made into types.

Pete
Reply
#5
(09-25-2022, 09:33 AM)Pete Wrote: :
or ...
DIM SHARED test(0) AS STRING * 256

...and

REDIM test(100) ' Sometime later.

Unfortunately, arrays were not able to be made into types.

Pete
I think both statements have to be "REDIM" for this to work...
[Image: unhan-except-mkde-sc26.png]
Reply




Users browsing this thread: 2 Guest(s)