Error code, etc.

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

Error code, etc.

Postby niels olsen » Jun 09, 2018 14:30

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: 83
Joined: Aug 08, 2009 6:01
Contact:

Re: Error code, etc.

Postby ecxjoe » Jun 09, 2018 18:08

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

Re: Error code, etc.

Postby badidea » Jun 09, 2018 18:25

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
Posts: 8361
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: Error code, etc.

Postby fxm » Jun 09, 2018 18:36

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: 27
Joined: May 28, 2006 18:32
Location: denmark

Re: Error code, etc.

Postby niels olsen » Jun 11, 2018 7:26

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: 5956
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Error code, etc.

Postby counting_pine » Jun 11, 2018 13:13

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:

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests