GLBasic forum

Main forum => Bug Reports => Topic started by: hardyx on 2017-Oct-13

Title: GLBasic 15.004 bug and solution
Post by: hardyx on 2017-Oct-13
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.
Title: Re: GLBasic 15.004 bug and solution
Post by: hardyx on 2017-Oct-19
No replies :'(  :'(
Title: Re: GLBasic 15.004 bug and solution
Post by: erico on 2017-Oct-19
Hi hardyx,
I´d like to help but the level of the problem you seem to have is beyond my skills.
Title: Re: GLBasic 15.004 bug and solution
Post by: Schranz0r on 2017-Oct-20
Never run into this error :D

My Types start normal with variables and then Functions  :x
So, is this a bug or a feature? ;)
Title: Re: GLBasic 15.004 bug and solution
Post by: hardyx on 2017-Oct-22
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

Title: Re: GLBasic 15.004 bug and solution
Post by: Kitty Hello on 2017-Oct-26
Fixed in next update.
Title: Re: GLBasic 15.004 bug and solution
Post by: hardyx on 2017-Oct-26
Thank you Gernot!!! :good: