QB64 Phoenix Edition
Cannot convert expression type to symbol - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: Cannot convert expression type to symbol (/showthread.php?tid=917)



Cannot convert expression type to symbol - eoredson - 09-25-2022

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.


RE: Cannot convert expression type to symbol - justsomeguy - 09-25-2022

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



RE: Cannot convert expression type to symbol - mnrvovrfc - 09-25-2022

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.


RE: Cannot convert expression type to symbol - Pete - 09-25-2022

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


RE: Cannot convert expression type to symbol - mnrvovrfc - 09-26-2022

(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]