problem adding -rr to command line

General FreeBASIC programming questions.
Post Reply
wallyg
Posts: 270
Joined: May 08, 2009 7:08
Location: Tucson Arizona

problem adding -rr to command line

Post by wallyg »

I have a program that compiles and runs successfully. I then add -rr to the command line and I now get a syntax error.

I am using the up to date version of the compiler that is supplied with winfbe.

The command line that is used:

C:\WinFBE_Suite\FreeBASIC-1.07.1-gcc-5.2\fbc32.exe -m "C:\Users\wfgaz\OneDrive\Testbed\TestBed.bas" -v -g -exx -s gui -rr -x "C:\Users\wfgaz\OneDrive\Testbed\TestBed.exe"

The line

gtk_init(@__FB_ARGC__, @__FB_ARGV__)

successfully compiles without -rr.

When I specify -rr on the command line I get the following error.

Error 42: Variable not declared, __FB_ARGC__in gtk_init(@__FB_ARGC__,@__FB_ARGV__)

What am I doing wrong?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: problem adding -rr to command line

Post by MrSwiss »

Try putting the: -rr -x (options) before the -s gui option and see (might just make a difference).
fxm
Moderator
Posts: 12126
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: problem adding -rr to command line

Post by fxm »

I don't know if there is a report, but I have already pointed out to the author of WinFBE that the name of the file associated with the -m option should normally be specified without an extension.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: problem adding -rr to command line

Post by MrSwiss »

Also related to: -m
It is also "case sensitve"
Manual has a warning: wrote:WARNING: the spelling of < source file > is case-sensitive! (unexpected ERRORS may otherwise occure)
I've had exactly the same problem (fbfrog) that "correct case" cured.

Using CLI-compile, should solve the IDE problem.
wallyg
Posts: 270
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: problem adding -rr to command line

Post by wallyg »

Without the -rr option the rest of the command line works properly and does what it is supposed to do. So no case problems.

I only had a problem when I added a couple of additional options. By removing them one by one, I found that -rr was what caused the problem.
fxm
Moderator
Posts: 12126
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: problem adding -rr to command line

Post by fxm »

You should try what we offer before concluding that it is unrelated to your problem.
wallyg
Posts: 270
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: problem adding -rr to command line

Post by wallyg »

The case of the filenames are correct.

I have tried moving the -rr parameter to different locations. And the result is the same.

Using winFBE, most of the parameters are placed on the line by winFBE. In the area of "additional parameters" I removed all other parameters and only added just one item -rr. And the error still occurs.

I have no control where the -x parameter is placed on the command line. By specifying that this is a GUI program to winFBE, it decides where to put it (-s GUI). I do not get to choose where it is placed on the command line. So yes I did listen to the comments and did what I could and just reported that it is still not working.

I do not see anything I am doing wrong according to the most up to date documentation. The order I place parameters is not specified in the documentation and regardless the addition of a compiler option should not cause one FB system symbol to become undefined. If anything an error on the use of -rr should be generated if a problem with its use happens. The program is quite large and only this line generates an error (however, it is the only place I use __FB_ARGC__). The rest of the program compiles without error. And only if I place -rr as an additional parameter does the compiler generate this error.

I have to admit that I have not used -rr in the past, and thought maybe I needed to add some other parameter or needed to do something special in order to get it to work. That was the reason for my post. I never expected a FB system symbol to go undefined.

Thank you all for your suggestions.

Wally
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: problem adding -rr to command line

Post by MrSwiss »

Use a console to compile, instead of WinFBE.
Needs a bit of typing but, eliminates the "fixed ordering" of options, from WinFBE.
Also: removes the -m option, which isn't needed for a "single file" compile.
(first file is by default used, to generate __FB_MAIN__ in it)
fxm
Moderator
Posts: 12126
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: problem adding -rr to command line

Post by fxm »

I can compile a program 'test.bas' (including __FB_ARGC__) with this command line:
fbc -rr -m test test.bas
or
fbc -rr -m test test.bas -x test.exe

(fbc -rr -m test.bas test.bas does not work)
(fbc -rr test.bas does not work)
(fbc -rr test.bas -x test.exe does not work)
(fbc -rr test -x test.exe does not work)

For your problem, the proper command line should be:
C:\WinFBE_Suite\FreeBASIC-1.07.1-gcc-5.2\fbc32.exe -m "C:\Users\wfgaz\OneDrive\Testbed\TestBed" -v -g -exx -s gui -rr "C:\Users\wfgaz\OneDrive\Testbed\TestBed.bas"
or
C:\WinFBE_Suite\FreeBASIC-1.07.1-gcc-5.2\fbc32.exe -m "C:\Users\wfgaz\OneDrive\Testbed\TestBed" -v -g -exx -s gui -rr "C:\Users\wfgaz\OneDrive\Testbed\TestBed.bas" -x "C:\Users\wfgaz\OneDrive\Testbed\TestBed.exe"

Extracts of documentation:
When using the -rr option, -m must be specified when compiling a main source file.
The -m compiler option specifies a main entry point for a source file; the argument is the name of a source file minus its extension.
So the main module file must be called twice in the command line:
- after compile option "-m", but without specified extension,
- and also like any module to compile, but there with its specified extension.

WARNING: the spelling of < source file > is case-sensitive! (unexpected ERRORS may otherwise occure)
Last edited by fxm on Jul 24, 2020 21:58, edited 3 times in total.
wallyg
Posts: 270
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: problem adding -rr to command line

Post by wallyg »

Thank you. Would it be possible to send this to the maker of winFBE?
PaulSquires
Posts: 1002
Joined: Jul 14, 2005 23:41

Re: problem adding -rr to command line

Post by PaulSquires »

Thanks for the reports. I have logged this problem and will fix for the next update.
fxm
Moderator
Posts: 12126
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: problem adding -rr to command line

Post by fxm »

To sum up, I think the general formula to take into account the possible -rr option (and to work with for example __FB_ARGC__) is:
  • fbc [-rr] -m "module1" "module1.bas" "module2.bas" "module3.bas" ..... -x "module.exe"
    [list]"module1" being the main module
    -x "module.exe" to name the executable
    • plus any other possible option
[/list]
Note:
- "module1" (without extension) for -m
- "module1.bas" (with extension) as for any module to be compiled

@PaulSquires,
I'm sorry to relaunch my remark on the same subject (see viewtopic.php?p=266126#p266126), but here (because of possible option -rr) I think that we must scrupulously respect the syntax specified in the documentation.

And this goes for all other IDEs.
PaulSquires
Posts: 1002
Joined: Jul 14, 2005 23:41

Re: problem adding -rr to command line

Post by PaulSquires »

Hi fxm,

I am trying to resolve this problem. From my tests, it appears that the compile will fail if I try to specify a PATH in addition to the module name for the -m parameter.

Here are some examples based on compiling the WinFBE source code itself.

For example,

X:\PSS121\FB\WinFBE_Suite-Editor\FreeBASIC-1.07.1-gcc-8.4\fbc32.exe -m "X:\PSS121\FB\WinFBE\src\WinFBE" "X:\PSS121\FB\WinFBE\src\WinFBE.bas" "X:\PSS121\FB\WinFBE\src\WinFBE.rc" -v -s console -x "..\WinFBE32.exe" -R -v

error 81: Invalid command-line option, "X:\PSS121\FB\WinFBE\src\WinFBE"

If I simply omit the path and just use the file name (without extension) then it also fails. I presume it fails because it can not resolve the WinFBE name without the path (file not found?).

X:\PSS121\FB\WinFBE_Suite-Editor\FreeBASIC-1.07.1-gcc-8.4\fbc32.exe -m WinFBE "X:\PSS121\FB\WinFBE\src\WinFBE.bas" "X:\PSS121\FB\WinFBE\src\WinFBE.rc" -v -s console -x "..\WinFBE32.exe" -R -v

error 81: Invalid command-line option, "WinFBE"

However, if I use the full path with file extension then the compile will succeed:

X:\PSS121\FB\WinFBE_Suite-Editor\FreeBASIC-1.07.1-gcc-8.4\fbc32.exe -m "X:\PSS121\FB\WinFBE\src\WinFBE.bas" "X:\PSS121\FB\WinFBE\src\WinFBE.rc" -v -s console -x "..\WinFBE32.exe" -R -v

Successful Compile (Errors 0 Warnings 0)

Primary Source: X:\PSS121\FB\WinFBE\src\WinFBE.bas
Target Compilation: ..\WinFBE32.exe (1,330 KB, 1361920 bytes)
Compile Time: 2.8 seconds (2020-10-10 11:17:11)

I will keep thinking about what I'm doing wrong here because my approach is at odds with the documentation but it seems to work correctly even though it should not. I have to use full path names because of the way that I designed the compile process.
fxm
Moderator
Posts: 12126
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: problem adding -rr to command line

Post by fxm »

For me, the command with the perfect syntax would be:
X:\PSS121\FB\WinFBE_Suite-Editor\FreeBASIC-1.07.1-gcc-8.4\fbc32.exe -m "X:\PSS121\FB\WinFBE\src\WinFBE" "X:\PSS121\FB\WinFBE\src\WinFBE.bas" "X:\PSS121\FB\WinFBE\src\WinFBE.rc" -v -s console -x "X:\PSS121\FB\WinFBE\src\WinFBE32.exe" -R -v
Does it work?

Otherwise, the others with different variants are not documented, so at the whim of fbc!

Note: The main file must always be specified (with its extension) in the list of files to compile, even if it is also specified (without its extension) by the -m option.
PaulSquires
Posts: 1002
Joined: Jul 14, 2005 23:41

Re: problem adding -rr to command line

Post by PaulSquires »

fxm wrote:For me, the command with the perfect syntax would be:
X:\PSS121\FB\WinFBE_Suite-Editor\FreeBASIC-1.07.1-gcc-8.4\fbc32.exe -m "X:\PSS121\FB\WinFBE\src\WinFBE" "X:\PSS121\FB\WinFBE\src\WinFBE.bas" "X:\PSS121\FB\WinFBE\src\WinFBE.rc" -v -s console -x "X:\PSS121\FB\WinFBE\src\WinFBE32.exe" -R -v
Does it work?

Otherwise, the others with different variants are not documented, so at the whim of fbc!

Note: The main file must always be specified (with its extension) in the list of files to compile, even if it is also specified (without its extension) by the -m option.
Thanks fxm,

Yes, that does indeed seem to work if I invoke it from the command line in the \src folder. I will have to check closely how I am invoking this from within WinFBE to see if I am not setting default initial folder correctly or something similar.
Post Reply