Google Answers Logo
View Question
 
Q: Compiling a QBasic program ( Answered,   0 Comments )
Question  
Subject: Compiling a QBasic program
Category: Computers > Programming
Asked by: grilse-ga
List Price: $5.00
Posted: 27 Feb 2003 08:45 PST
Expires: 29 Mar 2003 08:45 PST
Question ID: 167855
How can I compile a program written in QBasic?  Would it run better
alongside other Windows programs than an uncompiled program (which at
the moment stops running when the Windows program is running)?
Answer  
Subject: Re: Compiling a QBasic program
Answered By: theta-ga on 27 Feb 2003 11:42 PST
 
Hi grilse-ga,
  While Microsoft stopped developing and supporting QBasic a long time
ago, it's many fans have ensured that Qbasic still remains fairly
popular among beginning programmers. Unfortunately, there are no
official QBasic compilers available. Still, there are a number of them
which are mostly(99%) QBasic compatible. But, keep in mind that,
depending on what your code does, there may be places where you need
to modify your code in order to get it to compile.

 Here is a list of basic code compilers that are mostly QBasic
compatible:
   - MS QuickBASIC: Microsoft QuickBasic is a scaled up version of
Qbasic and your best bet. It looks and feels just like QBasic. The
only difference is that under the "Run" menu there is an extra command
"Make EXE File". Most of your programs should run unmodified in
QuickBasic. For a discussion of how Qbasic differs from QuickBasic,
see:
             - UWL's QBasic FAQ Sheet PART 1 
               ( http://members.aol.com/_ht_a/uwlabs/faq1.htm#differ )

     You can download various versions of QuickBasic (for free) from :
             - QuickBasic Cafe > QBasic Compilers
               ( http://www.qbcafe.net/english/dl_pages/compiler/index.html
)

   - BCX : BCX is a BASIC to C source code convertor, and is free for
personal and professional use. Keep in mind though, that it does not
directly compile your BASIC programs. Instead, it converts your BASIC
code to C code, which you can then compile with a C compiler to
produce a Windows exe file.
     For more information, check out BCX's homepage at:
             - BCX : The Basic to C Translator by Kevin Diggins
               ( http://bcx.basicguru.com/ )

- PowerBasic: This is very popular commercial compiler for BASIC
programs, on both DOS and Windows platforms. Although it supports a
number of QBasic statements/keywords, it is not 100% compatible(The
DOS version claims 99% compatibility). So, if you don't mind switching
to an alternative version of BASIC, this product comes highly
recommended.
     For a comparison between the keywords supported by QuickBasic and
PowerBasic, see:
            - PowerBASIC: The PowerBASIC Language
              ( http://www.powerbasic.com/support/technote/features.asp
)

     For a list of various PowerBasic Compilers, see:
            - PowerBASIC: Compilers
              ( http://www.powerbasic.com/products/compiler.asp )


   For a list of compilers/interpreters available for the various
dialects of BASIC, check out:
         - BASICGuru Compilers/Interpreters List
           ( http://www.basicguru.com/abc/compilers.html )

+----------------------------------------------------------+
  
To answer the second part of your question, compiling your programs
will usually result in a huge speed boost and decrease in loading
times. If you use a DOS compiler(QuickBasic, PB for DOS), then a DOS
executeble is created, which will run in DOS and (slightly slower) in
Windows. If you use a Windows compiler(BCX, PB for Win) then the exe
will run only in Windows, as a native application.

+-----------------------------------------------------------+

Hope this helps.
If you need any clarifications, please ask. I will be glad to be of
help.
Please do not rate this answer until it completely satisfies your
needs.

Thank You,
Theta-ga



========================================
Google/GoogleGroups Search Terms used:
       compile qbasic programs windows
       compile qbasic programs

Request for Answer Clarification by grilse-ga on 22 Apr 2003 04:46 PDT
Many thanks for the information.  Sorry for the delay in response -
too busy!
I downloaded QuickBasic3.00 (1987) and loaded my program written on
QBasic (1995 version).  QuickBasic3.00 has only a very elementary help
file.  It does have the compile option but complains about:-
1.  LINE INPUT statements
2.  LOOP WHILE statements
3.  SLEEP statements
I have tried various alternatives but cannot get them to work.  Is
there a better HELP file.
The variables in the sample programs are all plain letters or words,
without distinguishing between chars. and numbers with $ and %.  Is it
OK to leave these symbols in?

Many thanks.

Clarification of Answer by theta-ga on 22 Apr 2003 06:19 PDT
Hi grilse-ga,
   Since QBasic was a language that evolved with every new release of
the package, running code written on the later versions of QBasic on
the older versions, may require making (sometimes major) changes to
your program.
   In your case, I recommend you try QBasic version 4.5 or above, as
they come with better online help, and also support the LINE INPUT, DO
LOOP WHILE and SLEEP statements.
   As for the Qbasic variable naming conventions, it does not require
you to append the $ and % symbols to distinguish between the variable
data type. You can still add these symbols if you so desire, but their
presence or absence  makes no difference to the Qbasic compiler.
  If you are looking for help with QBasic, there are a number of
resources for you to try on the net. The Google Web Directory lists
pages related to QBasic programming here:
   - Google Directory:Computers>Programming>Languages>BASIC>QBasic &
QuickBasic
     (http://directory.google.com/Top/Computers/Programming/Languages/BASIC/QBasic_and_QuickBasic/)
  Most of the sites have tutorials or FAQs for newbies, which should
answer most of your questions. Many also provide chatrooms and forums
where you can have your questions answered by other QBasic
programmers.

Hope this helps.
If you need any clarifications, just ask!
Regards,
Theta-ga
:-)

===============================
RELATED LINKS:
  - Differences in various versions of QuickBASIC
    (http://www.geocities.com/thetropics/9964/qhelp3.html)
  - The QBasic Page
    (http://www.qbasic.com/qbindex.shtml)
  - List of QBasic Keywords
    (http://members.tripod.com/~connorr/guide/syntax/index.htm)
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy