Error? ayuda porfavor

Previous topic - Next topic

Jonás Perusquía

Que significa esto? :S

Code (glbasic) Select

_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:71fa70a5 - 3D, NET
Wordcount:36 commands
compiling:
C:\Users\JonasPm\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `DGInt __GLBASIC__::start()':
C:\Users\JonasPm\AppData\Local\Temp\glbasic\gpc_temp0.cpp:94: error: conversion from `__GLBASIC__::CGStr' to `bool' is ambiguous
Q:/Compiler/platform/Include/glb.h:144: note: candidates are: __GLBASIC__::CGStr::operator DGInt() const
Q:/Compiler/platform/Include/glb.h:145: note:                 __GLBASIC__::CGStr::operator DGNat() const
Q:/Compiler/platform/Include/glb.h:147: note:                 __GLBASIC__::CGStr::operator const char*() const
Q:/Compiler/platform/Include/glb.h:148: note:                 __GLBASIC__::CGStr::operator char*() const
C:\Users\JonasPm\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `DGInt __GLBASIC__::nextt()':
C:\Users\JonasPm\AppData\Local\Temp\glbasic\gpc_temp0.cpp:176: error: conversion from `__GLBASIC__::CGStr' to `bool' is ambiguous
Q:/Compiler/platform/Include/glb.h:144: note: candidates are: __GLBASIC__::CGStr::operator DGInt() const
Q:/Compiler/platform/Include/glb.h:145: note:                 __GLBASIC__::CGStr::operator DGNat() const
Q:/Compiler/platform/Include/glb.h:147: note:                 __GLBASIC__::CGStr::operator const char*() const
Q:/Compiler/platform/Include/glb.h:148: note:                 __GLBASIC__::CGStr::operator char*() const
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 2.5 sec. Time: 23:35
Build: 0 succeeded.
*** 1 FAILED ***


me sale al querer compilar esto:

Code (glbasic) Select
// ---START PROJECT--- //

SETCURRENTDIR("Media") // go to media files

GLOBAL a$,b$,c$,d$,sx,sy
GETSCREENSIZE sx,sy
LOADFONT "smalfont.png",0
LOADFONT "correct.png",1
LOADFONT "incorrect.png",2

GOSUB start

SUB start:
DRAWRECT 0,0,sx,10, RGB(226,226,216)

SETFONT 0
PRINT "Escribe una palabra con b o v",100,100
INPUT a$ ,100,150

IF a$ = "palabra" OR "vivir"
SETFONT 1
PRINT "CORRECTO!",100,200
ELSE
SETFONT 2
PRINT "INCORRECTO",100,200
ENDIF
SETFONT 0
PRINT "TIP:Se escribe con B Los verbos terminados en –bir,-buir",20,250
SETFONT 0
PRINT "Presiona una tecla para continuar",100,300
SHOWSCREEN
GOSUB nextt
ENDSUB


SUB nextt:
CLEARSCREEN
SETFONT 0
PRINT "Escribe una palabra con nv",100,100
INPUT b$,100,150
IF b$ = "envidia" OR "invitar"
SETFONT 1
PRINT "CORRECTO",100,200
ELSE
SETFONT 2
PRINT "INCORRECTO",100,200
ENDIF

SHOWSCREEN
END
ENDSUB
<HTML><BASIC><EC>
Be free and do good things

kaotiklabs

No me hagas mucho caso pero a bote pronto diria que pruebes a substituir

IF a$ = "palabra" OR "vivir"
por
IF a$ = "palabra" OR a$ = "vivir"

lo mismo para el otro IF posterior
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

hardyx

#2
Si, en esos dos IF tienes que completar la segunda condición.

Code (glbasic) Select
IF a$ = "palabra" OR a$ = "vivir"

IF b$ = "envidia" OR b$ = "invitar"


Como recomendación (no es un error), también pondría las llamadas a las subrutinas y el END en el programa principal, así te será más fácil seguir el hilo cuando crezca tu programa. Así quedarían las llamadas:

Code (glbasic) Select
GOSUB start
GOSUB nextt
END


mentalthink

Pues como te dicen cuando pasan esos errores raros es por esté tipo de cosas....

Como dice hardyx y kaoticslabs es el tema de no poner la variable delante del or...

Yo te daria una recomendación si me lo permites, y es que las opciones o sea las posibilidades que metes entre las "comillas" las haria con arrays, asi, si quieres agrandar la posibilidades lo tendrás muy sencillo... algo como

posibilidad$[0]="tal"
posibilidad$[1]="cual"
posibilidad$[2]="pascual"
n...
n-1...
y luego seria

if variable_de_Input$=psobilidad[0] then haz tal cosa
if variable_de_Input$=psobilidad[1] then haz la  otra cosa
if variable_de_Input$=psobilidad[1] then haz otra cosa totalmente distinta...
n
n-1...




Jonás Perusquía

Gracias amigos, pude resolver el problema con ELSEIF, pero tambien voy a probar sus sugerencias y luego les comento, muchas gracias!!!
<HTML><BASIC><EC>
Be free and do good things