GLBasic 15.004 bug and solution

Previous topic - Next topic

hardyx

I have GLBasic v15 and works ok, but I can't update to version 15.005, the update works but the version remains in 15.004. I don't know if the next error is fixed in the 15.005 update. This can be related with this other post: http://www.glbasic.com/forum/index.php?topic=11066.0

The bug occurs compiling a TYPE in my code. It's normal code not using inline C++.

Code (glbasic) Select
// type with some functions
TYPE Dialogos
FUNCTION Iniciar:
            // some code...
        ENDFUNCTION
        // more functions...
ENDTYPE


Code (glbasic) Select
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.14.721
Wordcount:877 commands
compiling:
In file included from C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:1:
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h: In constructor `__GLBASIC__::Dialogos::Dialogos()':
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h:54: error: expected identifier before '{' token
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h:54: error: expected `(' before '{' token

(Many error lines like the last three....)


Looking at the generated code (gpc_temp.h) I can see the compiling error:

Code (glbasic) Select
class Dialogos
{
GLB_DECLARE_TYPE_DEBUGGER;
public:
        // some code here ...
Dialogos(): // <--- this is bad

{
GLB_IMPLEMENT_TYPE_DEBUGGER;
}
        // more code here...
}


The generated code fails because the ":" should not be there. This happens because my TYPE have not any member variables in it. If I put a dummy variable in the TYPE like this, the code compiles and links Ok. This "patch" must be done in each TYPE that does not have variables.

Code (glbasic) Select
TYPE Dialogos
dummy% // fix glb15 fail

        // class with some functions and no variables
FUNCTION Iniciar:
            // some code...
        ENDFUNCTION
        // more functions...
ENDTYPE


The generated code is good now and compiles without errors:
Code (glbasic) Select

class Dialogos
{
GLB_DECLARE_TYPE_DEBUGGER;
public:
Dialogos(): // <-- this is ok now
REGISTER_MEMBER_DEF(dummy,0)

{
GLB_IMPLEMENT_TYPE_DEBUGGER;
}
}


I hope this can be fixed.

hardyx


erico

Hi hardyx,
I´d like to help but the level of the problem you seem to have is beyond my skills.

Schranz0r

Never run into this error :D

My Types start normal with variables and then Functions  :x
So, is this a bug or a feature? ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

hardyx

I have some utility TYPES that doesn't have variables, others are normal types.
Putting a dummy variable works ok, but it's an error in the code generation.

Enviado desde mi SM-A310F mediante Tapatalk


Kitty Hello


hardyx