QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: kservice on September 24, 2021, 10:35:38 am
-
Tell me, please, what is the error?
[ This attachment cannot be displayed inline in 'Print Page' view ]
Error in line 124
-
In your source code is not SUB named as zaglavie:
here is your source code
...
..
..
..
..
here is your SUBs and FUNCTIONs
SUB zaglavie
...
... next source code in this SUB
...
END SUB
-
You didn't separate the Call from the comment:
Call zaglavie1
():
rem ...
Notice:
1- Call is optional:
2- rem is optional, if you use the apostrophe - and if you don't use rem, you don't have to separate the comment from the main line with a colon:
-
Here is example:
@FellippeHeitor it works also without : separator with REM :)
-
@kservice
Next option is, if zagalvie1 SUB exists in your source code, remove brackets from CALL statement.
-
In your source code is not SUB named as zaglavie:
All called functions are in a separate file.
[ This attachment cannot be displayed inline in 'Print Page' view ]
After separating the function of the function and the comment has not changed
[ This attachment cannot be displayed inline in 'Print Page' view ]
-
So zaglavie1 is not SUB, because if is, then you must have this error message:
(SUB must be included at the end the source code)
[ This attachment cannot be displayed inline in 'Print Page' view ]
-
Can you call a sub with blank parameters? If it’s blank, shouldn’t it just be omitted?
CALL X()
SUB X
PRINT “foo”
END
-
Hi
Fine behaviour...
Call print2
Rem ' it is a modern comment print2
Rem it
is a classical comment
Print "Hi I'm SUB print2 and I do this...";
[ This attachment cannot be displayed inline in 'Print Page' view ]
yes I can confirm that the error is NOT related to the absence of : between print2 and Rem
moreover also if I type : the error stays there.
If I erase the () all become ok.
Are there some differences with QB45? I dunno.
-
It’s the blank parameters.
Call x()
Sub x()
PRINT “foo”
End Sub
[ This attachment cannot be displayed inline in 'Print Page' view ]
-
Yes trying the same code in QBasic
this last warns the user to put arguments between ( )
Moreover it doesn't tolerate a REM without a : before it!
-
Yeah, today I learned QB64 doesn't mind if there's a colon before a REM comment.
It's only mandatory in DATA lines.
-
Thanks to all for participation and advice. The program is large, many different functions that I combined into the plug-in file.
Advise how to better make functions from this file? Can there be 2-3 connected files?
The program was created for many years ago for QB45 and now, when there is free time, trying to transfer to QB64. On QB45 everything worked. Here, apparently, checking over compiling more careful.
I'm trying to figure it out. So far not everything turns out. So I take a break. I am free from other cases - I will continue.
Checked such a test variant - works without errors
[ This attachment cannot be displayed inline in 'Print Page' view ]
-
In the QB45 program i am used the FRE(-1) command. In QB64, this keyword is not supported. Something can be replaced?
Or here it is not necessary?
And another question. I repeatedly use the functions of the form
Sub Chtenie1 (SKLSUM#, U$, f$, NB$, NE$, DT$, FRM$, RR, C, PP, tov() As Tovar).
Variable tov () AS Tovar is read from the f$ file. This is an array, in each row of which 4 pemet. But at the same time an
"IncorRect Array Type Passed to Sub" error occurs.
How can this problem be solved?
-
There's no direct equivalent to FRE() in QB64. You will have to query the operating system (research the API) to check how much free memory is available.
Unless your program relied directly on knowing how much free memory there was, you can probably safely remove the FRE() occurrences.
-
It's clear. And what about an "IncorRect Array Type Passed to Sub" error ?
-
I probably did something wrong if I stopped answering my questions? In this case, I ask the yen to apologize.
-
It's clear. And what about an "IncorRect Array Type Passed to Sub" error ?
Incorrect Array Type Passed to Sub comes from... wait for it... passing an incorrect array type to a SUB!! 😂😂
An example:
SUB Foo (an_array() AS INTEGER)
...stuff
ENS SUB
A fairly standard SUB, doing standard stuff with an array. All is good here, until:
DIM data_array(100) AS LONG
Foo data_array()
Now our SUB expects an array of INTEGER type. We just tried to pass it an array of LONG type. What’s the result?
You guessed it!
Incorrect Array Type Passed to Sub Error
Pass them the types they except and you won’t see that message any more.
-
Thank you, I will understand
-
When i try to rename an old file to file.bak and data records to a new file, I collided with such errors:
[ This attachment cannot be displayed inline in 'Print Page' view ] [ This attachment cannot be displayed inline in 'Print Page' view ]
What can you suggest?
-
Refinement: String 2426 This is a string: Name F2 $ AS MID $ (F2 $, 1, Len (F2 $) - 3) + "BAK"
I noticed that if you make a Name "bigbad.txt" as "badwolf.txt", then this error disappears. But I need to use a conditional f2$, as each time they are different when using the procedure. In other words, I need this option: Name "f2$" AS "f2new$"
How can I get out of this position?
In QB45 it worked. Is it possible to find a solution option in QV64?
-
The last problem is solved by the use of Field 2, 10 AS ...... and LSET .... instead of Print # 2, using "##############. ##