IDE - QB64 Wiki

IDE

From QB64 Wiki

Jump to: navigation, search

IDE refers to the Integrated Development Environment or Editor used by QB64. Since the Editor is not an Interpreter, you cannot test code to see how it works without compiling it into an EXE file first! Pressing F5 will compile error free code and run the EXE file.

Errors may not be reported, but a compiler failure will be reported in the Status area! Errors that are reported after compilation may be due to missing program files! All program files MUST be placed in the QB64 folder to run the compiled code with the IDE!

Programs can be compiled WITHOUT the associated program files by pressing F11 or by compiling the code from the command line or a batch file. The command line to compile a program in the QB64 folder is: QB64 -c filename.BAS or QB64 -c %1 in a batch file.


It's a good idea to exclude "QB64.exe" from any real-time anti-virus scanning to prevent IDE Module Errors!
Compiler Errors
Compiler Command Line and Batch Files
QB64GL IDE Settings


Command Line

QB64 COMPILER V1.1 USAGE: qb64 [switches] <inputs> OPTIONS: <file> Source file to load -c Compile instead of edit -x Compile instead of edit and output the result to the console -z Generate C code without compiling to executable -o <file> Write output executable to <file> -e Enables OPTION _EXPLICIT, making variable declaration mandatory (per-compilation; doesn't affect source file or global settings) -s[:switch=true/false] View/edit compiler settings

Editor

Alt + Enter will make the Editor full screen or alternately reduce it back to a window.

██ QB64 _  X 

 File   Edit   View   Search   Run   Options Help

┌────────────────────────────────────█Untitled█──────────────┤Find[                      ↕]├┐ │DEFINT A-Z │DIM Array(100)_ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒ │ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ────────────────────────────────────── Status ──────────────────────────────────────────────┤ │OK │ │ │ ▒ │ ▒ │

2:15

The Status area displays the current status of code entries. The status may indicate code or syntax errors!
The present cursor location is displayed as the code text row:column in the aqua bar at the bottom of the IDE window.


The QB64 Integrated Development Editor Features

The 0.95 version update will involve downloading about 400 very small files (these are pre-cached help files) so it may take a few more minutes to complete but it is worth the wait. The files are used by the new integrated Help system menu available as of version 0.95.

  • Recently opened files list in File Menu lists up to 4 previously used files. Click Recent for a list of more files.
  • Bulk comment and uncomment. Click Comment in Edit Menu to comment or un-comment highlighted code lines.
  • Quick movement between code bookmarks. Alt + Left arrow adds or removes a bookmark(slash in left border area).
  • Quick Find search field at top of edit area. Click on ↕ arrow for a list of recently searched items.
  • CONTROL + left/right arrow to move between words of text in your code.
  • Double click text already in one line menu text entry fields to clear an item from the box area quickly.
  • Copy (CTRL + C or CTRL + INS) and Paste (CTRL + V or SHIFT + INS) into single line menu text entry fields.
  • Mouse wheel scrolls menu lists once a list or scroll bar is clicked on.
  • Press alphabetical keys in the File menu list, SUB window list and others to jump through listed items.
  • View/open/edit/save TEXT files with any extension, not just .BAS (you might like to use .BI for include files)
  • Backward word searching using SHIFT + F3.
  • Click on the ON LINE ## part of an error message box(now highlighted) to jump to that error location.
  • HOME key now toggles between the absolute left hand side on the first press and the first indented character next press.
  • The QB64 IDE may allow Alt + number pad character entries, but they must be inside of STRING values. Otherwise the IDE may not recognize them.
Additional updates to IDE and Menu quick access settings

File Menu (Alt + F):

New Opens a new Editor screen. May prompt to save or Restore previous code. Open... Opens existing TEXT files. Displays list of BAS files when BAS only box is checked. Save Saves present code in the Editor as TEXT file. Prompts for new file name if "Untitled" Save As... Saves the present code as a new BAS file name if you choose to change it. ────────────────────────── ...ic\qb64\ScreenMode.bas List of up to four most recently edited files ...Basic\qb64\Console.bas Recent... Clicking on Recent opens a separate scroll list of all recently accessed files. ────────────────────────── Update SDL version only! Compiler updates no longer available. Manage updates in the Options Menu. ────────────────────────── Exit Exits the Editor. Any new code or changes will prompt the user to save them.

White letters indicate CTRL + letter shortcuts with menu open
Allow updates to complete before using the Compiler or Editor! Use the Options menu to turn off or set up Automatic QB64 Updates.
Versions .095 and above allow the Save file name entry to be cleared by double clicking it.
Back to IDE

Edit Menu (Alt + E):

Cut Shift+Del or CTRL+X Cuts highlighted text and saves it to system Clipboard. Copy Ctrl+Ins or CTRL+C Copies highlighted text and saves it to system Clipboard. Paste Shift+Ins or CTRL+V Pastes contents of system Clipboard to last cursor position. Clear Del Clears all highlighted text from the Editor. Code is NOT saved! Select All CTRL+A Highlights all of the code text in the Editor. ──────────────────────────── Undo CTRL+Z Removes multiple code edits since previous undo or redo (V.94) Redo CTRL+Y Restores multiple undone code edits (V.94) ──────────────────────────── Comment (add ') Highlight code and click to block comment an area of code. Uncomment (remove ') Highlight code and click to uncomment an area of code. ──────────────────────────── New Sub... Creates a new Sub after the name is entered in the dialog box. New Function... Creates new Function after the name is entered in the dialog box.

White letters indicate CTRL + letter shortcuts with menu open
WARNING: Hitting a key on the keyboard may remove all of the highlighted code! Use UNDO!
The Undo buffer can hold up to 2,000 Megabytes of program code that can be retrieved later using Undo when code is lost!
The default Undo buffer size is set to 100 Megs by default, but it can be set higher in the Options menu.
The buffer will retain all code entered until it exceeds the maximum size.
NOTE: Code from previous edits can be RETRIEVED using Undo(Ctrl + Z) when the QB64 IDE is first started!


Back to IDE

View Menu (Alt + V):

SUBs... (F2) Opens a list of the Sub and Function procedure names to be viewed individually.

White letters indicate CTRL + letter shortcuts with menu open


Back to IDE

Search Menu (Alt + S):

Find... Searches for highlighted words/text entered in the dialog box. Match Case or word. Repeat Last Find (Shift+) F3 Finds more instances of text in a program. Shift+F3 for Reverse. Change... Substitutes text for new text in the program using Find and Verify or Change All. ────────────────────────────── Add/Remove Bookmark ALT+Left Places or removes a - dash in the left editor border. Next Bookmark ALT+Down Moves editor code view down to next bookmark. Previous Bookmark ALT+Up Moves editor code view up to next bookmark. ────────────────────────────── Go to Line... Moves editor view to specified code line

White letters indicate CTRL + letter shortcuts with menu open


Back to IDE

Run Menu (Alt + R):

Start F5 Compiles into EXE file and runs program(with code whiteout). ─────────────────────────── Start (Detached) Ctrl+F5 Compiles into EXE and runs program separately (no code whiteout). Make EXE Only F11 Compiles into EXE without program files if there are no errors. ─────────────────────────── Make Android Project GL Compiled program as Android project(enabled in Options)

Function keys compile without entering menu
If the code has just been created and was not saved in the IDE, the name of the compiled program will be "Untitled(n).exe"
Associated text $INCLUDE code files, LIBRARY DLL files and C++ .h header files must be in the QB64 folder to compile.

Only the associated DLL files need to be included with the program EXE after it is compiled.

(The compiler can find Windows DLL files in the System folder and C++ DLL files in the QB64 folder.)

No additional program files need to be in the QB64 folder to Make EXE Only!

The compiled EXE file can then be moved to a different folder holding the program files necessary when it is run.


Back to IDE

Options Menu (Alt + O):

Display... Sets dimensions of Editor above 80 X 25 with specific Fonts and row heights. Language... Sets the extended language Unicode character Code Page to be used editing. Code Layout... Sets the Editor up for spacing, auto-caps of keywords, and code indentation. Update... SDL only! Updates are no longer available remotely online. Backup/Undo... Sets the Undo buffer limit from 10 to 2000 MB maximum(default 100 MB) ─────────────────────────── Advanced... GL advanced settings: Embed Debug Info, investigate crashes, etc. Swap Mouse Buttons GL swap of right and left mouse buttons. ─────────────────────────── Google Android... GL Android check box for Android option in Run menu and set batch path

White letters indicate CTRL + letter shortcuts with menu open


The GL Editor foreground colors can be changed! See QB64GL IDE Text Color Settings above


Back to IDE

Help Menu (Alt + H):

Effective as of Version 0.95

View Shift + F1 Returns to most recent Help page view Contents page Select Alphabetical, By Usage or FAQ Keyword index View keyword list by alphabetical name Keywords by Usage View keywords by usage ASCII chart Displays ASCII characters and ASC values. Math Solves numerical equations entered by user into box. ───────────────────── Update current page Updates only the current help page from WIKI Update all pages Updates all WIKI help information. This may take a while. ───────────────────── About... Displays the current version of QB64 being used.

White letters indicate CTRL + letter shortcuts with menu open
Note: Click in the Help window to scroll page info or click on blue links. Clicking the X or Escape exits Help Menu when active.
Help System Features:
  • Linked to WIKI. Update Help pages at least once a month to stay current.
  • Cached for speed but updated on demand.
  • F1 or Shift + F1 for help about a keyword (or symbol) the cursor is currently on in your code.
  • F6 switches the active cursor between the Help screen and the code area alternately.
  • Navigation ribbon for moving forward and backwards between recently viewed help pages.
  • Typing a word quickly finds links on help pages (very useful on large index pages).
  • Fully keyboard and/or mouse browsable.
  • ASCII chart (and value of cursor's ASCII character shown).
Updating of the WIKI help information is recommended about once a month to stay up to date
Back to IDE

QB64GL IDE Settings:

Text and keyword colors can be set in the QB64GL IDE by changing the _RGB color intensities in the following file:

QB64\internal\IDEcolor.txt

85, 255, 255, 'Comment RGB Color 85, 255, 85, 'MetaCommand RGB Color 255, 255, 85, 'Quote RGB Color 255, 255, 255, 'Text RGB Color

OR change a few extra settings plus text and background colors if this file is present:

QB64\internal\config.txt

IDE_AndroidMenu = FALSE IDE_AndroidStartScript$ = "programs\android\start_android.bat" IDE_AndroidMakeScript$ = "programs\android\start_android.bat" '[GENERAL SETTINGS] DebugInfo = FALSE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE! BackupSize = 100 'in MB AllowIndependentSettings = FALSE '[IDE COLOR SETTINGS] TextColor = _RGB32(255,255,255) QuoteColor = _RGB32(255,255,85) MetaCommandColor = _RGB32(85,255,85) CommentColor = _RGB32(85,255,255) BackgroundColor = _RGB32(0,0,170) '[IDE DISPLAY SETTINGS] IDE_CodePage = 0 IDE_CustomFont = FALSE IDE_CustomFont$ = "c:\windows\fonts\lucon.ttf" IDE_CustomFontSize = 21 IDE_AutoFormat = TRUE IDE_AutoIndent = TRUE IDE_IndentSize = 4 IDE_Height = 48 IDE_Width = 136 IDE_AutoPosition = FALSE IDE_LeftPosition = 0 IDE_TopPosition = 0 '[MOUSE SETTINGS] SwapMouseButton = FALSE

Explanation of IDE configuration settings


Back to Top

QB64 Requirements:

Windows Compiled EXE Programs Require DLL Files to run in SDL ONLY!

Once the program EXE has been created, it can be moved to its own separate folder with the QB64 DLL files. It CANNOT run without those files! They must be included with any program package made available to other people or to be used on other computers.


List of required QB64 program DLL files in SDL only.


Download QB64 DLL files in a Zip File
The Zip file above can be used to unzip the required DLL files into any program folder, system folder or download package necessary.


WARNING! Do not place DATA fields after SUB or FUNCTION procedures! QB64 will FAIL to compile properly!
Qbasic allowed programmers to add DATA fields anywhere because the IDE separated the main code from other procedures.
Back to Top

Command Line and Batch Files:

No other program files besides the BAS file are required! Use the following command to compile a program without running it:

QB64 -c yourfile.BAS

One advantage to compiling without running a program is that the QB64 editor will require that ALL of the necessary program files be placed inside of the QB64 folder or errors will occur when it is run! Also the EXE file will not be made or will disappear as it is no longer a valid application! To run the newly created EXE file, MOVE IT BACK to the location where your other program files reside.

NOTE: You must also copy the QB64 DLL libraries to the new program's folder location!


The batch file below can compile any BAS file from any location using drag and drop. The EXE will be created in the QB64 folder:

@ECHO OFF Set QB64=%~dp0 Echo. QB64 path: %QB64% CD "%QB64%" cmd /c start /low QB64.exe -c %1

Place the BAT file in the QB64 folder! You will also be able to drag and drop BAS files onto the batchfile.


Automating the Compilation Process
The batch file below will compile and move the EXE to the BAS file location when clicked on from the right click menu.

@Echo off Title QB64 Compiler color 5F REM BATCH file MUST be in the QB64 folder! Set QB64=%~dp0 Echo.QB64 Path: %QB64% REM Get filename only: Set FILE=%~nx1 Echo.BAS file: %FILE% REM Replace BAS with EXE: SET BASfile=%FILE% SET EXEfile=%BASfile:.BAS=.EXE% Echo.EXE file: %EXEfile% Echo. REM Get BAS file path: Set OLDIR=%CD% Set "OLDPATH=%OLDIR%\%EXEfile%" REM Change to the QB64 folder path: CD "%QB64%" REM Set QB64 folder path: Set "NEWPATH=%QB64%%EXEfile%" REM Display Paths: Echo.QB64 file: %NEWPATH% Echo.Move file: %OLDPATH% REM Compile BAS file: cmd /c start /low QB64.exe -c %1 REM Skip COPY if compiling BAS file in the QB64 folder: IF "%NEWPATH%" == "%OLDPATH%" GOTO END ELSE GOTO Check :Check IF EXIST "%NEWPATH%" (GOTO Finish) ELSE (PING 127.0.0.1 -w 1000 -n 3 >NUL) GOTO Check :Finish REM second ping below may be necessary for slow compilations. PING 127.0.0.1 -w 1000 -n 10 >NUL ECHO. MOVE /-Y "%NEWPATH%" "%OLDIR%" REM COPY "%NEWPATH%" "%OLDPATH%" /-Y ECHO. REM Pause GOTO END :END CLS

Note: You can use COPY or MOVE to place the EXE file where the BAS file is located. Remove the /-Y parts for no prompt.


Download the QB64 Editor and Compiler Shortcuts and Compile Error Batch Files


Associating the batch file in the Right Click Open With pop-up menu

You can associate the batch file to the Right Click Popup Menu's Open With dialogue choices when you right click ANY BAS file:

1) Right click any BAS file and move to Open With and click Choose Program in the pop-up menu.
2) Your batch file will not be in the program choices so select Browse.
3) Navigate to the batch file in the QB64 folder and click on it.
4) Make sure that the Always use this program box is NOT checked! Then save your choice.
The compiled EXE file will always be created in the QB64 folder first!


WARNING! You may need Administrator rights to install or use QB64!
Back to Top

Permission Errors

  • Reference:70-????? = permission denied
Something on your system is trying to access the files QB64 is using. Or maybe you are trying to run 2 copies of QB64 at once and something is going wrong.

How to Grant Permissions in Windows 7 1. Locate the file or folder on which you want to take ownership in Windows Explorer. 2. Right click on file or folder and select “Properties” from Context Menu. 3. Click on Edit button in Properties windows Click ok to confirm UAC elevation request. 4. Select user/group from permission windows or click add to add other user or group. 5. Under Permission section check the rights to grant or check “Full Control” under the “Allow” column to assign full access control permissions to the Administrators group. 6. Click OK for changes to take effect and click final OK to exit from Properties window. Now you can access files of folder in Windows 7 with full permissions and take full control.

How to take ownership of a program

Compiler Error Troubleshooting

C++ COMPILATION FAILED!
It's a good idea to exclude "QB64.exe" from any real-time anti-virus scanning to prevent IDE Module Errors!
Immediately after seeing this message, go into the "qb64\internal\temp" folder of your QB64 installation and run the file recompile.bat (on Linux it is called recompile.sh, on MacOSX recompile.command).
Report this output along with the .BAS code of the QB64 program causing the error.
Note: 99% of the time a C++ COMPILATION FAILED message will be the result of invalid .BAS code which the QB64 IDE failed to identify and report before the C++ compilation process. Check for missed quotes and punctuation!


Here's a recent example of QB64 code which causes this error:

IF a = 1 AND AND 2 THEN b = 2

After reporting the problem (to be fixed properly!), try to fix (or workaround) the issue by locating the source of the error:
Step 1: Look at the output from recompile.bat, it will probably mention a specific line within a file (the line usually ends up being within qb64/internal/temp/main.txt). Even though the file's extension may be '.txt' it contains C/C++ source code.
Step 2: Locate the line within the main.txt file before compiling anything else.
Step 3: Examine the line and its surrounding lines by looking at the names of variables (eg. '__SINGLE_A') and subs or functions (eg. 'func__loadimage'). Trying to figure out which part of your .BAS code the C code represents may involve some guess-work, but otherwise you will have to wait for a response if you report it to the forum!
Step 4: Modify your .BAS code at that location (or code related to that location) until the error no longer occurs.


Batch file places compiler errors into the 0utput64.txt file which can be Posted to the Forum

@echo off ECHO. ECHO Diagnosing Latest Compilation Error ECHO. ECHO Please wait... ECHO. cd .\internal\c .\bin\g -w -Wall -I.\i -I..\..\ -L.\l qbx.cpp libqbx.o -mwindows .\i686-w64-mingw32\lib\libimm32.a -lwinspool -lmingw32 -ln -lmix -limg -lttf -lmn -lSDL -s -o ..\..\ >..\..\0utput64.txt 2>&1 cd ..\.. ECHO. ECHO 0utput64.txt created! ECHO. PAUSE

' Note: Make sure that 0utput64.txt 2>&1 is at the end of the long code line when copying!


To create the Batch file, copy code above to Notepad and save it as QB64ERR.BAT. Save as type: All Files.


Download the QB64 Editor and Compiler Shortcuts and Compile Error Batch Files


Back to Top

References:

Why won't QB64 work at all on my computer?


Alternate IDE downloads:


See also:


Known QB64 Issues


Report Compiler Bugs here!



<center>Navigation:

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Personal tools