UNDEFINED FUNCTION

170 views
Skip to first unread message

hardy

unread,
Oct 2, 2012, 12:16:19 AM10/2/12
to harbou...@googlegroups.com

I am a novice programmer transitioning from Clipper 5.2d to Harbour.    I’ve read the documentation I can find at harbour-project.net.  (Why does it seem everything is repeated twice on the documentation I find there?) I have searched this site as well.  I would love to find a source like Booth, Lief and Yellick’s reference on Clipper 5.2 which was so helpful to me as I began to learn Clipper.  But I gather there is nothing like that for Harbour.  I am open to any helpful links offered.  I have found Giovanni Di Maria’s reference guides for Hourbour at the elektosoft website as well.

I have tried to figure out what the various EXE’s in the Harbour download are for.  Looks like HBRUN.EXE runs a prg file but doesn’t work if there are multiple prg’s involved in a project.  True?  Any other use for HBRUN?

How about a debugger? (I spend lots of time in CLD.EXE when I’m writing something new and it would help as I rework my prg’s for Harbour.)  I’ve experimented with the –b option in HBMK2 but can’t get anything to run like CLD.  Tried Alt-D but nothing happens. 

Currently I am really stuck on a Base 1001 error: undefined function.  I am using HBMK2 with a list of many prg’s in a hbp file:  HBMK2 @myproject.hbp  I have set harbourcmd=/n /w /a in autoexec.bat   I am running Windows XP and working at the command prompt.  I got one project to compile and run, but now I am stuck on this second project.  I have an editor.prg using memoedit() at its core with Function EFUNC() as the user defined function.  EFUNC() is defined in the editor.prg along with 7 other functions.  When HBMK2 runs I can see editor.prg complied with “functions/procedures 9” but I get the error at runtime when the program calls editor.prg and cannot find EFUNC().  I tried cutting EFUNC() out of the editor.prg  and listing it separately in the hbp file but I get the same error.  What am I doing wrong?

By the way, what is the difference between a hbp and hbm file?  If I am using HBMK2 as noted above, should it be hbm rather than an hbp file?  (These are the kinds of details I would like to find documentation for.)

Thanks for whatever help you can give.

 

marek.h...@interia.pl

unread,
Oct 2, 2012, 7:42:45 AM10/2/12
to harbou...@googlegroups.com



"hardy" <hardyha...@gmail.com> pisze:

I am a novice programmer transitioning from Clipper 5.2d to Harbour.    I’ve read the documentation I can find at harbour-

[...]

Currently I am really stuck on a Base 1001 error: undefined function.  I am using HBMK2 with a list of many prg’s in a hbp file:  HBMK2 @myproject.hbp  I have set harbourcmd=/n /w /a in autoexec.bat   I am running Windows XP and working at the command prompt.  I got one project to compile and run, but now I am stuck on this second project.  I have an editor.prg using memoedit() at its core with Function EFUNC() as the user defined function.  EFUNC() is defined in the editor.prg along with 7


Request EFUNC //??


Regards,

Marek Horodyski

Juan L. Gamero

unread,
Oct 2, 2012, 8:27:20 AM10/2/12
to harbou...@googlegroups.com


El martes, 2 de octubre de 2012 06:16:19 UTC+2, hardy escribió:

Currently I am really stuck on a Base 1001 error: undefined function.  I am using HBMK2 with a list of many prg’s in a hbp file:  HBMK2 @myproject.hbp  I have set harbourcmd=/n /w /a in autoexec.bat   I am running Windows XP and working at the command prompt.  I got one project to compile and run, but now I am stuck on this second project.  I have an editor.prg using memoedit() at its core with Function EFUNC() as the user defined function.  EFUNC() is defined in the editor.prg along with 7 other functions.  When HBMK2 runs I can see editor.prg complied with “functions/procedures 9” but I get the error at runtime when the program calls editor.prg and cannot find EFUNC().  I tried cutting EFUNC() out of the editor.prg  and listing it separately in the hbp file but I get the same error.  What am I doing wrong?


Hardy:

If you already didn't I recomend you to read INSTALL document (see your Harbour root dir), section 11. QUICK START TO BUILD YOUR OWN HARBOUR APPLICATIONS.

I suspect the command should be:

hbmk2 myproject.hbp

(without @)

Hope it helps

hardy

unread,
Oct 3, 2012, 12:55:47 AM10/3/12
to harbou...@googlegroups.com

 

Juan—

I was looking at HBMK2 –HELP  near the end under “Notes:”

 

<script> can be:

      <@script> or <script.hbm>: command line options in file

      <script.hbp>: command line options in file, it also marks a new target if specified on the command line

 

You are right: @myfile.hbp is not listed but it does seem to work with or without the @.  I find it does not work without the extension, whether I name the file hbp or hbm.  And either way I got the same error at runtime.

 

Marek—

I’m not sure what your mean.  Are you asking to see my code in EFUNC() ?

Regardless I worked some more and got it fixed.  The  editor.prg parameters are handled by this code:

IF EMPTY(IUSER)

          TUSER = "EFUNC()"

ELSE

          TUSER = IUSER

ENDIF

..........

This is the memoedit call that comes later:

THEFILE = MEMOEDIT(THEFILE,TTOP,TLEFT,TBOT,TRIGHT,.T.,TUSER,TRIGHT-TLEFT,TTAB,TR,TC,NWR,NWC)

This has worked fine in Clipper.  Tonight I put EFUNC() directly in the memoedit call instead of TUSER and it worked.  Maybe it needs a macro in Harbour? 

I just tried &TUSER in the memoedit call and worked!   So I’m learning.  Now I’ve got another error a few lines down so I’ll go work on that one.

I also tried the debugger again tonight.  With /b in set harbourcmd and -b for HBMK2 I was able to open the debugger with Alt-D.  I figured out how to set the path to find the source code.  But is it possible to work in split screen like CLD  /S ?

 

 

Juan L. Gamero

unread,
Oct 3, 2012, 5:10:16 AM10/3/12
to harbou...@googlegroups.com

El miércoles, 3 de octubre de 2012 06:55:47 UTC+2, hardy escribió:

 

Juan—

I was looking at HBMK2 –HELP  near the end under “Notes:”

 

<script> can be:

      <@script> or <script.hbm>: command line options in file

      <script.hbp>: command line options in file, it also marks a new target if specified on the command line

 

You are right: @myfile.hbp is not listed but it does seem to work with or without the @.  I find it does not work without the extension, whether I name the file hbp or hbm.  And either way I got the same error at runtime.



Hardy:

Yes, sorry, it was also my fault because I didn't noticed that use of the '@' in script. I was confused by the use of the '@' in the .clp and I thought that it could interact with the scope or visivility of your function. To clarify:

.hbp : Project file with target definition, options, dependencies, etc. (it could contain .hbm files)
.hbm : A collection of options (it is almost an .hbp file but without targets, its usually included in .hbp files)
.clp : A list of source files that will be compiled into one module (see. xhb-diff.txt "COMPILE TIME SUPPORT FOR MERGING MULTIPLE .PRG MODULES").

as I understand reading hbmk2 --help and syntax, you can do the following:

hbmk2 project.hbp options.hbm
or
hbmk2 project.hbp @options

hbmk2 prog1.prg prog2.prg @multi.clp @options

Hope it is of any help.

Regards
--
Juan Luis

Qatan

unread,
Oct 3, 2012, 5:23:58 AM10/3/12
to harbou...@googlegroups.com
Hello,
 
 
>as I understand reading hbmk2 --help and syntax, you can do the following:
>hbmk2 project.hbp options.hbm
>or
>hbmk2 project.hbp @options
>hbmk2 prog1.prg prog2.prg @multi.clp @options
 
 
    I just saw it and I hope it may help.
    I only use .HBP file with all inside it. It makes simple for me.
    Example:
 
project.hbp
 
------>8------
-es
-w3
-inc
-gui
-L..\inc
 
-lhbct
-lhbmemio
 
-oExefile
 
prog1
prog2
progC.c
resorc.rc
------8<------
 
    First I put all the flags
    Then the list of required libs
    Next is the name of the final executable
    Then I have the list of my sources (can be .PRG .C .RC)
    I think this way gives me a good vision of the whole... anyway with HBMK2 you can do many ways – it is very flexible.
    Regards,
 
Qatan   
 

hardy

unread,
Oct 3, 2012, 10:34:37 PM10/3/12
to harbou...@googlegroups.com

Thank you both for the clarification of the files.  That puts me a little further along down the road! 

Reply all
Reply to author
Forward
0 new messages