Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


xHarbour beginner

xHarbour beginner

xHarbour beginner

Hi All,

I'm having trouble with starting in xHarbour.
I installed the open source binary files and the Borland compiler BCC55.
I tried, as a start, a simple "Hello World" PRG.
After a bit of searching in newsgroups and the internet, I managed to get a complete compile-and-link cycle without any errors.
The resulting .EXE file starts but does nothing.  No errors, but no signs of executing at all.
I tried a few alternatives like putting in a tone() function to see if I can HEAR anything, or putting in a BIG loop to see if the execution would take longer.  But it doesn't matter: after I start the EXE it immediatly comes back to the DOS prompt no complaints, but no results either.

I know I'm not giving much details, but maybe it is a common thing and someone will know right away whats going wrong?

Thanks for any help

RE: xHarbour beginner

Could you post the source of your hello world program, and the compile- and link-scripts, so we could see what would be needed to get you going?
Most interesting from the scripts would be the parameters on the harbour command-line, and the name of the GTxxx lib you used.


RE: xHarbour beginner

Ok TonHu, here is the source code:


? "Hello world"



It's from the samples of the XHarbour Builder Demo download and it's as plain as could be.  I included the starting and ending dashes manually in this message.

I use the following .BAT script to build the app:
@echo off
SET HARBOURCMD=/a /es2 /gc0 /m /n /q /w2
SET INCLUDE=D:\xh\include;D:\bcc55\include
IF EXIST %1.prg D:\xh\bin\harbour %1
IF EXIST %1.c d:\bcc55\bin\bcc32 +d:\xh\xh.cfg -c %1.c
IF EXIST %1.obj d:\bcc55\bin\ilink32 %1.obj, %1.EXE @d:\xh\xh.rsp
IF EXIST %1.c DEL %1.c
IF EXIST %1.obj DEL %1.obj
IF EXIST %1.tds DEL %1.tds

Here is the xh.cfg file:

and this is the xh.rsp file
/ap +
/Gn +
/Ld:\xh\lib;d:\bcc55\lib;d:\bcc55\lib\pdsk +

pp.lib +
rtl.lib +
vm.lib +
common.lib +
lang.lib +
gtwin.lib +
rdd.lib +
dbffpt.lib +
dbfntx.lib +
dbfcdx.lib +
hbsix.lib +
macro.lib +
pcrepos.lib +
hbodbc.lib +
ct.lib +
tip.lib +
import32.lib +

The script, .CFG and .RSP files I borrowed from a newsgroup and is for testing now, but I would use a make utillity once I get things going of course.

As it is, I get no errors or warnings from harbour, BCC or ilink32.  The compile and link happily.
The program just doesn't do anything.  I first suspected the console interface for not showing on the screen, so I tried adding a large loop and tone() calls, but the execution doesn't take any longer or makes any noice.

RE: xHarbour beginner

You could try to build a new makefile by using HBMAKE in interactive mode to create it: HBMAKE hello.bc /EX
and running the 'make' process by: HBMAKE hello.bc

This usually works fine...


RE: xHarbour beginner


Ok, I tried the HBMAKE, but no luck.
I still get a resulting EXE but it doesn't do anything.
In noticed, after going thru the interactive build (I left all the standard settings), the question is asked if I want to make the program.  When I do, I see a compile... message with progression bar.  The bar is at 100% immediately, and underneath the ilink message is showing.  After a second, the prompt returns and I have a .EXE .bc and MAKEFILE.LNK.  Also a OBJ directory has been created (the first time) but nothing is in it.  I actually find NO MYHELLO.OBJ file anywhere.  The only MYHELLO.??? files after the make are MYHELLO.BC, MYHELLO.LOG and MYHELLO.EXE.
When I run the make a second time with HBMAKE MYHELLO.BC, I see the same compile prohression bar, but this time it stays at 0% as if nothing compiles.  But then I should get an error message from the ilink32, wich I don't.

Here is the MAKEFILE.LNK
-Ld:\bcc55\lib\obj;d:\bcc55\lib;d:\xh\lib -Gn -M -m -s -Tpe -x -ap +
c0x32.obj, +
myhello.exe,, +
optcon.lib lang.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib dbffpt.lib common.lib gtwin.lib codepage.lib ct.lib tip.lib pcrepos.lib hsx.lib hbsix.lib import32.lib cw32.lib, +
, +

and this is the MYHELLO.LOG file:
xHarbour Compiler build 0.99.60 (SimpLex)
Copyright 1999-2006, http://www.xharbour.org http://www.harbour-project.org/

Syntax:  d:\xh\bin\harbour.exe <file[s][.prg]> [options]

Options:  /a               automatic memvar declaration
          /b               debug info
          /build           display detailed version info
          /credits         display credits
          /d<id>[=<val>]   #define <id>
          /es[<level>]     set exit severity
          /g<type>         output type generated is <type> (see below)
          /gc[<type>]      output type: C source (.c) (default)
                           <type>: 0=compact 1=normal 2=verbose (default)
                                   3=generate variable list (.var) file
          /go              output type: Platform dependant object module
          /gw              output type: Windows/DOS OBJ32 (.obj)
          /gh              output type: Harbour Portable Object (.hrb)
          /gj              output type: Java source (.java)
          /i<path>         #include file search path
          /j[<file>]       output i18n support [to <file>] to .hil
          /k               compilation mode (type -k? for more data)
          /l               suppress line number information
          /m               compile module only
          /n[<type>]       no implicit starting procedure (default)
                           <type>: 0=no implicit starting procedure
                                   1=no starting procedure at all
                                   2=force application starting procedure
          /o<path>         object file drive and/or path
          /p               generate pre-processed output (.ppo) file
          /pt              generate pre-processor trace (.ppt) file
          /q               quiet
          /q0              quiet and don't display program header
          /s               syntax check only
          /u[[+]<file>]    use command def set in <file> (or none)
          /undef:<id>      #undef <id>
          /v               variables are assumed M->
          /w[<level>]      set warning level number (0..3, default 1)
          /x[<prefix>]     set symbol init function name prefix (for .c only)
          /z               suppress shortcutting (.and. & .or.)
          @<file>          compile list of modules in <file>


From the LOG file, it looks as if the harbour compiler was run without any parameters...

The most puzzling thing to me is that I get an EXE file without any trace of an intermediate .C or .OBJ file.  I can't think that the HBMAKE program removes the .X and .OBJ files after linking, because then a make utillity would be useless.

Maybe there are some clues here for anyone, but I'm stuck.

RE: xHarbour beginner


I just tried all your steps you mentioned in your last message. Hope I repeated them as you did, and the only way to make an executable that does nothing, and not have a myhello.obj file is when I didn't select the myhello.prg source in the source-file selection-box.
That's right, it has to be selected by using the space-bar! I hope you didn't leave that important step out! The <Enter> key is defined as "I'm ready with my selection and want to continue", and it happily thrundles along creating an exe that does exactly nothing...

BTW, it ran just fine over here, displaying


Hello world
Press any key to continue...

RE: xHarbour beginner


Thanks TonHu,

that did the trick.  I had only one .PRG file in that directory, so only one showed up in the list and I just entered on it.  I realise now that, of course, one should be able to select more files for a multi-module system.

Anyhow, it worked... but it didn't:
I get an unresolved external _HB_FUN___DBGENTRY from the linker.  I quickly tried linking in all the available external LIBs, but still no luck.  I'm looking into it now to see wich LIB is missing, but I first wanted to reply to your message before looking any further.
Please let me know if you got any idea about the missing external.  I let you know if/when I find it myself.

RE: xHarbour beginner


I did some research...

_HB_FUN___DBGENTRY is in harbour.lib off course.
I noticed that the MAKEFILE.LNK produced by HBMAKE doesn't refer to harbour.lib.
So I added harbour.lib manually (just before optcon.lib) and ran ilink32 @makefile.lnk manually.
This resulted in an executable MYHELLO.EXE but this got a complaint from XP saying "Cannot find harbour.DLL".
The I copied harbour.dll from the harbour lib directory to windows system32. Then the app ran but ended up with faults.


RE: xHarbour beginner

As explained before, I re-created your situation as close as possible. The _DBGENTRY is AFAIK induced by setting a Debug option to true somewhere, I've left all HBMake options and settings to the default it presented me, so if you could try to re-create the HBMake script (overwriting the original) should probably solve this.
I must also state that my development environment is locally compiled from developer-CVS source, not the binary release or anonymous CVS. But seeing no other reports of _DBGENTRY missing I can safely assume this isn't a known error.

Adding harbour.lib to your linkscript is only needed when you want to deliver a (set of) small .exe's and 1 (big) runtime DLL. That also shouldn't give errors at runtime.

Still a little puzzled by your troubles though...

I'll try to test with the 'production' release of xHB soon, if time permits.


RE: xHarbour beginner


Thanks TonHu,

meanwhile, I found out that everything worked if I check the "debug info /b" setting during interactive make (all the rest left default).  So I guess, in that case, the debug.lib is linked in and you are right: it has something to do with inducing debug.  Only, I don't know why I have to include debug info.  I wouldn't mind including debug info but I'm sure  I shouldn't have to.  I fear the apps will be larger/slower with debug info included?  Anyway, meanwhile things start to work.  I found out how to create my own lib with the /ELX parameter and I am experimenting a bit before starting to migrate my big Clipper app.  Impressed by the speed already.

Thanks so far

RE: xHarbour beginner

I was also fighting with this issue. To clarify this: when you use /B switch during compiling, to resulting code is added debug info - probably there are calls to functions included in debug.lib - that's why there is the need to link this library when compiling with /B switch. If you omit this switch, you can exclude from linker list debug.lib library. As of Clipper itself: to stop the program execution you should use Alt-D keys combination. Alternative way is to add within source code simple call to the debugger - AltD(). Unfortunately I noticed that there are some problems with xHarbour debugger - when it starts, it works ok for me, but when flow switches to another source module, the debugger collapses - firstly it can't find the actual source code file, when trying to load it, it enters infinite loop asking for this filename and finally crashes the debugged application - thisa is what happens on my system.


RE: xHarbour beginner

Did you test with last 'official' release or are you running with current CVS version? There are several improvements in the CVS that probably address the issues you are pointing out here.


RE: xHarbour beginner

Hi TonHu,

these issues I describe are very recent problems - I tried xHarbour before, this what I described happened with release downloaded within last 3-4 days unfortunately.


RE: xHarbour beginner

Yeah, but 'Downloaded' probably means you have the binaries of last march, and these are quite 'vintage'.
You could try the xharbour.com 30 days trial version to see how it fares, as that was updated last week or so.

If you search a bit further there are sites to download precompiled current versions, but I'll _try_ to 'persuede' the right ppl to update these outdated binaries.

If OTOH you have current CVS sources and compiled them yourself, and these problems still occur, I'd report that in the nntp news that's available.

BTW, I'm not using the debugger ATM, I usually just slap-in some (log)messages or popup's ...


RE: xHarbour beginner

Thanks TonHu for your answer. Indeed, the download contained quite obsolete version. For now I stick back to old good (??? - big smile) Clipper. I made my project work with xHarbour (debugger excluded of course), but I can't use anymore time to make further checks. To check with commercial version I would have to port it again to this demo (these are many files). I was hoping that libraries set was the same - but I was wrong. My own compiled xHarbour seems to be out of my reach - too difficult for me for now big smile


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close