Error code, etc.

New to FreeBASIC? Post your questions here.
Post Reply
niels olsen
Posts: 29
Joined: May 28, 2006 18:32
Location: denmark

Error code, etc.

Post by niels olsen »

In upper right corner "Help" "Error Codes" shows only 17 codes. When activating a calculation-program I encountered codes 95 and 97. Where
to find those? The accompanying text (97) is: Branch crossing local array, var-len ... . What does that mean? And how to deal with such an error?
Where to find an instruction manual with error codes? My Free Basic IDE is: ver. 0.4.6, date Feb 19, 2006, wxW.: 2.6.2.
I encountered the above problems when I tryed to run my program. I wanted the program to GOTO a part of the program. This part is a seperate
program which I have copied into the main program. A GOTO for get back to main program is also there. Both the main program and extension program work fine before "joining". None of the two programs contains references to external sources. The main program is approximately 5000
lines, the extension program is only 100 lines. I have with success copied this extension program (Lagrange interpolation) into other programs.
I am looking forward reply
Yours sincerely
Niels Olsen
ecxjoe
Posts: 96
Joined: Aug 08, 2009 6:01
Location: Utah, USA
Contact:

Re: Error code, etc.

Post by ecxjoe »

Try compiling with the "-exx" option. That might give you more details.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Error code, etc.

Post by badidea »

I think, this error can occur if the goto label/position is inside a subroutine and the goto statement outside the sub.
Last edited by badidea on Jun 11, 2018 18:05, edited 1 time in total.
fxm
Moderator
Posts: 12108
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Error code, etc.

Post by fxm »

Simple example inducing such an error message:

Code: Select all

goto label
dim as string s
label:
error 105: Branch crossing local array, var-len string or object definition, to label: LABEL, local string: S

- Easy solution if that works:
Try to compile your program in -lang qb or -lang fblite

Code: Select all

#lang "qb"  '' or #lang "fblite"

goto label
dim as string s
label:
OK

- If your program cannot be compiled in -lang qb or -lang fblite, the solution is less obvious.
niels olsen
Posts: 29
Joined: May 28, 2006 18:32
Location: denmark

Re: Error code, etc.

Post by niels olsen »

Dear Sirs,
I thank you very much for your help. I learned something about Freebasic.
My problem was solved by using #lang "fblite".
Yours sincerely
Niels Olsen
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Error code, etc.

Post by counting_pine »

If you want to keep it compiling in the default dialect, then you can probably fix it by rearranging the code so that the Dim statements appear earlier in the code, e.g. with fxm's example:

Code: Select all

dim as string s
goto label
[s = ...]
...
label:
(If the Dim initialises 's', it would mean moving the Dim but keeping the assignment where it is.)

Or maybe you can limit the scope of 's' to the place it's used:

Code: Select all

goto label
scope
  dim as string s
  ...
end scope
label:
Post Reply