Upgraded from 8.2 to lastest verion Issue

Previous topic - Next topic

Leginus

Just upgraded from 8.2 to the latest version and my code has gone breasts to the sky.

It seems that none of the types that are declared in a separate source file are being initialised and i get the famous
Quote"wrong argument type : TYPE  is not declared"

If i put the type declarations in the main code, all works fine again.

Is there something that I have missed on the recent upgrades where I have to specify the program to look at this source code file first?
I remember this being an issue many moons ago, but the it was fixed and been fantastic ever since.

Any insight would be greatly appreciated.

Oh and just to add a strange one to the mix, if I open the source in 8.2 it works fine, if i open it it v9(the lastest) it doesnt. 
If I then REOPEN in back in 8.2 I then get the error in 8.2 and it stops initialising them  :giveup:

MrTAToad

It sounds like some types need to be initialised in a specific order.  (Un)fortunately the latest version re-sorts the source files by name order, thus possibly causing the problem.  See http://www.glbasic.com/forum/index.php?topic=5933.0 for more details.

Leginus

Thanks for response MrTAToad

I have just fixed the problem and was in process of updating.
Here is the problem and solution.

If in a separate source file you have the following

Code (glbasic) Select

TYPE Sprite
Active
ENDTYPE
GLOBAL Sprites[] AS Sprite


it wont work.  HOWEVER, if you move the
Code (glbasic) Select
GLOBAL Sprites[] AS Sprite to your main source and leave the TYPE declaration in you separarte source file, it works fine.

So the conclusion is that TYPE are fine in a separate source, but the GLOBAL must be in the main source.

MrTAToad


Leginus


MrTAToad

I was fortunate with mine as in most cases a TYPE is only used in the file that it's defined it :)