Author Topic: C++ COMPILATION FAILED?  (Read 759 times)


  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
« on: March 06, 2012, 07:06:23 PM »

Immediately after seeing this message, go into the "internal" then "temp" folder of your QB64 installation and run the file 'qb64/internal/temp/recompile_win.bat' (on Linux it is called '', on MacOSX 'recompile_osx.command'), and 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 QB64 failed to identify and report before the C++ compilation process.
Here's a recent example of QB64 code which causes this error:
Code: [Select]
IF a = 1 AND AND 2 THEN b = 2
After reporting the problem (because it needs to be fixed properly!), you can 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 file.
Step 3: Examining the line and its surrounding lines by looking at the names of variables (eg. '__SINGLE_A') and subs/functions (eg. 'func__loadimage') try and figure out which part of your .BAS code the C code represents. Yes, some guess-work might be involved!
Step 4: Modify your .BAS code at that location (or code related to that location) until the error no longer occurs.

Ideally, C++ compilation failure should never occur in QB64 because it indicates the QB64 compiler has failed to do its job properly. Sorry for the inconvenience.

PS. Are you using the DECLARE LIBRARY command in your .BAS code?
If so, then please discuss the C++ compilation failure in the 'Library Discussion Forum' section of this forum. DECLARE LIBRARY allows you to indirectly add custom C++ code and so compilation errors are unlikely to indicate a fault in QB64.
« Last Edit: April 03, 2013, 09:42:50 PM by Galleon »
Something old... Something new... Something borrowed... Something blue...