Compiling software

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
PhilClark
Newbie
Posts: 6
Joined: Mon Dec 14, 2015 9:35 am

Compiling software

Post by PhilClark »

I have a lot of programs that I have written using QB45 but now that I have a Windoze 7 64-bit machine I have just installed QB64 on that. I am now having a couple of obvious problems using the QB64 software.

I have the QBASIC software installed in C:\QB64 and all of my source code is located in C:\SOURCE. I have a batch file called BASIC.BAT. For QB45 I simply run this as BASIC PROGRAM_NAME and this adds .BAS to PROGRAM_NAME and loads the file into the QB45 editor. I then compile the program and the .EVE file is located in C:\QB45.

I have taken BASIC.BAT and changed the directory from QB45 to QB64 and the executable file to QB64. Also, the batch file has QB64 set as one of the paths which I set (similar to the original batch file for QB45). So, the relevant part of the batch file is:

PATH C:\BATCH;C:\QB64
CD QB64
QB64 C:\SOURCE\%1.BAS /AH
DEL C:\SOURCE\*.BAK

%1 is the variable that defines the root name of the program to be compiled, PROGRAM_NAME.

Problem 1. When I run BASIC PROGRAM_NAME I get an error message to say that PROGRAM_NAME.BAS has not been found. Since QB64 is apparently fully compatible with QB45 and the command runs for QB45 I cannot see anything obviously wrong. Maybe QB64 does not accept the options /AH at the end of the command line? Or maybe it does not understand "%1.BAS" which forms the name of the file to be accessed. In any case, I can then load PROGRAM_NAME.BAS by hand.

Problem 2. I then compile the program. I see that there are just two options on the drop-down compared with QB45, but as usual I run the command to compile the source code. No error messages are generated but I can find no trace of the .EXE file on my hard disk.

Maybe I am doing something wrong that is obvious to people used to using QB64, but I am open to suggestions, please.

Many thanks in advance.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Compiling software

Post by burger2227 »

The QB64 program uses a different command line.

QB64 -c C:\path\filename

The BAT file needs to run in the qb64 folder. The EXE will be created there too.

You can use a better BATch file that moves the EXE back to the original folder using Open With in Windows.
BAT files can be added to a BAS file associated Open With... in Windows too.

http://www.qb64.net/wiki/index.php/IDE# ... tch_Files:
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
PhilClark
Newbie
Posts: 6
Joined: Mon Dec 14, 2015 9:35 am

Re: Compiling software

Post by PhilClark »

A belated thank you for your help!
PhilClark
Newbie
Posts: 6
Joined: Mon Dec 14, 2015 9:35 am

Re: Compiling software

Post by PhilClark »

I have now amended by batch file to conform with the command line given above, but another problem has reared its head.

My existing QB45 files seem to have a character right at the end of the file and this needs to be edited out: not doing this results in the QB64 compiler crashing because it cannot recognise the character.

Unlike the QB45 compiler, the QB64 compiler does not do into the "edit" mode before doing the actual compiling. Is there a switch I can use on the command line to have QB64 open the file so I can edit it and only then create the .exe file? Or does the QB64.exe command literally compile the program and any editing has to be done with other software?

Thank you again!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Compiling software

Post by burger2227 »

What kind of files are you talking about? BAS files? How did you find the character was the problem?

Character 26 is often placed as the End of File (EOF) marker in files.

You could OPEN the files FOR BINARY AS #1, find the LOF(1) and PUT #1 , lof%, 32
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply