Is it possible?Linking with just link.exe without QB4.5?

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
Yazar
Coder
Posts: 11
Joined: Sat May 24, 2008 10:51 pm

Is it possible?Linking with just link.exe without QB4.5?

Post by Yazar »

Hi there. Can we make an exe file from a bas file just using the linker not the Qb4.5 itself ?

For example like that;

LINK.EXE "SCODE.BAS", "SCODE.EXE", "SCODE.LIB"

The problem is to create the obj file from the bas file. If I could create the obj file from the bas file, the

rest is very easy;

LINK.EXE "SCODE.OBJ", "SCODE.EXE", "SCODE.LIB"
Yazar
Coder
Posts: 11
Joined: Sat May 24, 2008 10:51 pm

Post by Yazar »

Sorry for that question. Long time, no coding in Qb, so I couldn't resolve this simple problem. I found the solution and decided to delete the topic but, what about sharing?

So this code does what I want;

Code: Select all

INPUT "File Name"; file$
k% = INSTR(1, file$, ".")
IF NOT k% THEN file$ = file$ + ".bas"
k% = INSTR(1, file$, ".")
newfile$ = MID$(file$, 1, k% - 1)
objname$ = newfile$ + ".obj"
listname$ = newfile$ + ".lst"
exename$ = newfile$ + ".exe"
mapname$ = newfile$ + ".exe"
SHELL "bc " + file$ + "," + objname$ + "," + newfile$ + ".lst"
SHELL "link " + objname$ + ", " + exename$ + ", " + mapname$ + ", qb.lib"
Qb runs but links another bas file....
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Compile them each with BC command from the QB dir:

Code: Select all

SHELL "BC MODULE1.BAS /O/S/E/X;"
SHELL "BC MODULE2.BAS /O/S/E/X;"

Then, link them both together as one program name like "MYPROG.EXE".

SHELL "LINK /E MODULE1+MODULE2,MYPROG.EXE,,BCOM45.LIB+QB.LIB"
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
OPRESION
Veteran
Posts: 61
Joined: Tue Jan 16, 2007 4:15 am
Location: Mexico

MAYBE THIS COULD HELP SOME MORE

Post by OPRESION »

MY PAGE: http://Qbasic.phatcode.net" target="_blank
(I ONLY USE WINDOWS 98SE YET, BELIEVE IT OR NOT)
Post Reply