Page 2 of 3
Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 4:06 pm
by Claudio Ricardo
Hi, in the Main.prg, You can try:
#pragma -w3
#pragma -es2
#include <hmg.ch>
Function Main
----> and all folow

Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 4:43 pm
by apais
there's so many ways to skin a cat!
Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 6:09 pm
by Red2
Hi Claudio,
I am still having no luck. I added your 2 suggested lines:
#pragma -w2
#pragma -es2
to the Project's Main.PRG.
The #include <hmg.ch> and all other necessary #includes were already there.
(Note: The IDE, previously, built this project perfectly and did so for months before.)
Unfortunately after adding these 2 lines the IDE now generats over 4900 lines of
(mostly) "Warning W0002" and the build now fails.
I simply want to find:
Variables declared but not used and Variables declared but not used.
===========================
Google Spanish:
Simplemente quiero encontrar:
Variables declaradas pero no utilizadas y Variables declaradas pero no utilizadas.
===========================
Any suggestions? Thank you all for all of your generous guidance.
Red2
Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 8:13 pm
by Claudio Ricardo
I made a mistake but edited it later when I noticed it... it's -w3 and not -w2
With just that line at the beginning it should warn you of errors
Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 10:12 pm
by Red2
Hi Ricardo,
Google Spanish:
¡Muchas gracias! Tu última publicación parece dar una solución.
Si solo incluyo #pragma -w3 al comienzo de un .PRG, entonces
la parte inferior del archivo build.log ahora contiene líneas descriptivas como:
Variable 'PNNBROWS' declarada pero no utilizada en la función...
La variable 'LLSTOP' está asignada pero no utilizada en la función...
Gracias a su amable y generosa orientación, parece que
ahora hay una solución que puedo poner en uso.
¡¡¡Una vez más, gracias!!! ¡Por favor acepte mi aprecio!
===================================================
Thank you so much! Your last post seems to give a solution.
If I only include #pragma -w3 at the beginning of a .PRG then
the bottom of file build.log now contains descriptive lines such as:
Variable 'PNNBRROWS' declared but not used in function ...
Variable 'LLSTOP' is assigned but not used in function ...
Thanks to your kind and most generous guidance it looks like
there is now a solution that I can put to use.
Again thank you!!! Please accept my appreciation!
Red2
Re: Undeclared Variables in a .PRG
Posted: Wed Mar 30, 2022 10:30 pm
by Claudio Ricardo
Hi, The credit goes to Mr. Roberto Lopez I took it out of his code, and there is much more to learn from him...
Re: Undeclared Variables in a .PRG
Posted: Thu Mar 31, 2022 12:41 am
by AUGE_OHR
hi Red,
you can -w1, -w2 or -w3 which will give you "all" Error
i use -w3 only when release to Customer while normal just -w1 to identify "not declare" -> Crash
-w3 also include "UNUSD" Variable. i ofter Declare Variable which i want to use "later"
---
when work with IDE you know *.HBP.
when write into "Configuration" Tab you will find a *.HBC when close IDE
last there is hbmk.HBM which can be found in every \HARBOUR\CONTRIB\*.* Folder
it include above *.HBC and Parameter with Compiler Option
i recommend to use Structure like those in \HARBOUR\CONTRIB\*.* Folder
special when use Source Code together with other Compiler like Xbase++
Re: Undeclared Variables in a .PRG
Posted: Thu Mar 31, 2022 12:17 pm
by Claudio Ricardo
Hi, I take advantage of the fact that the subject is being discussed to ask about these errors that appear
in three different programs but with the same lines:
C:\Programacion\Programas_Mios_Fuentes\FarmaCard_2\Main.Prg(149) Warning W0001 Ambiguous reference '_HMG_DEFAULTICONNAME'
This line have: SET Default Icon To "AaaaCard" This icon (.png) is in the .rc file and it shows up in all windows perfectly.
C:\Programacion\Programas_Mios_Fuentes\FarmaCard_2\Main.Prg(224) Warning W0001 Ambiguous reference '_HMG_MAINWINDOWFIRST'
C:\Programacion\Programas_Mios_Fuentes\FarmaCard_2\Main.Prg(242) Warning W0001 Ambiguous reference '_HMG_MAINWINDOWFIRST'
Code: Select all
SET WINDOW MAIN Off // <-- Line 224
Modulo_Coneccion_Al_Hosting () // Funcion de coneccion al hosting y DB's
// muestra una splash window
If ! Empty ( pcAdminPass ) // Si hay pass de administrador
Main_Usuarios () // Funcion de Login, show login window
Else // Si no hay pass de administrador entra directo
// es para la primera vez que se usa el programa
// y poder setear el pass de administrador y de usuarios
plAdminAccess := .T.
pcUsuario := "Administrador general"
MsgInfo ("Está iniciando sesión como Administrador general !" , "Permisos")
EndIf
SET WINDOW MAIN On // <-- Line 242
DEFINE WINDOW Main AT pnRowIniMain , pnColIniMain WIDTH nMinWidth HEIGHT nMinHeight VIRTUAL WIDTH Nil ;
VIRTUAL HEIGHT Nil TITLE pcSoftName + " - " + pcVersionIdLong ICON "AaaaCard" MAIN CURSOR NIL ; // and continue the code...
Since everything works fine, I didn't pay attention to it...
If anyone knows what is wrong I thank you in advance !
Re: Undeclared Variables in a .PRG
Posted: Thu Mar 31, 2022 1:05 pm
by serge_girard
Hi Claudio,
I have VERY MUCH similar "Warning W0001 Ambiguous reference"...!
Serge
Re: Undeclared Variables in a .PRG
Posted: Thu Mar 31, 2022 1:20 pm
by Claudio Ricardo
Hi Serge
They are the only ones I always receive, but since they are "internal" variables, I am worried that I am doing something wrong,
although the program works without problems.
Knowing that it is something "normal" I will stop paying attention to it.
Very grateful for your reply !