How to compile a HMG apps using Harbour hbmk2 ?

Source code related resources

Moderator: Rathinagiri

CCH4CLIPPER
Posts: 140
Joined: Tue Mar 03, 2009 8:59 am

How to compile a HMG apps using Harbour hbmk2 ?

Post by CCH4CLIPPER »

Hi All

If I want to compile a HMG app using hbmk2, how will the HmgProject.hbp look like ?

Cheers

CCH
http://cch4clipper.blogspot.com
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by l3whmg »

Hi CCH,
I don't know if this is a good way, but I use it for my project. On the other hand you must consider you installation and path to have the ability to call hbmk2.
Well, this is my simple project.hbp file where I put all .prg files (or you can insert .c files)
-w3 -es2

otherfile.hbc

gacqp000.prg
gacqp001.prg
gacqp002.prg
gacqp003.prg
gacqp004.prg
Inside otherfile.hbc (is optional, but I think usefull), you can also tell "Include paths", "libraries paths" and "libraries name" to add; example I write my personal library and include file and for this I insert inside .hbc. N.B. libraries name must be blank separated
incpaths=D:\HMG\L3wSys\Lib
libpaths=D:\HMG\L3wSys\Lib
libs=l3w_dbf
Now you can call "hbmk2 myproject.hbp". But remember: you must pay attention to have correct path in your environment vars or create a good batch command. I prefer second way!

I hope this can be usefull for you.

Best regard
Luigi from Italy
www.L3W.it
CCH4CLIPPER
Posts: 140
Joined: Tue Mar 03, 2009 8:59 am

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by CCH4CLIPPER »

Hi Luigi

TQVM for responding.

Yeah, your method is quite practical but what I was really asking is the names of the HMG libs that must be included in the hbp file.

For example, if I want to link in Xharbour code, I add

xhb.hbc
hbxpp.hbc

What I am puzzled is that using the HMG IDE, the project hbp file only contains my prg and no references to any HMG specific libs.

eg
frs4W764.prg
locks.prg


So when i hbmk2 frs4w764.hbp, I get

C:\hmg.3.0.35\PROJECTS\FRS4W764>hbmk2 frs4w764.hbp
Harbour 2.1.0rc1 (Rev. 16282)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'frs4W764.prg'...
frs4W764.prg(146) Error F0029 Can't open #include file 'minigui.ch'
hbmk2: Error: Running Harbour compiler (embedded). 1
(c:\hb21\bin\harbour.exe) -n2 frs4W764.prg locks.prg -oC:\Users\CCH\AppData\Loca
l\Temp\hbmk_3lhr70.dir\ -ic:\hb21\include

But if I use HMG-IDE to open frs4w764.hbp, I can successfully build frs4w764.exe

Can anyone clarify this ?

TIA

CCH
http://cch4clipper.blogspot.com
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by l3whmg »

Hi CCH,
I hope understand your problem. First of all: I don't use HMG-IDE!
In my previous post, I write about a good batch command! I derived from standard command build.bat; complete version it's compicated because, with the same command, I can: create lib or add/create resource file. For these reasons I write main pieces. Any way, this is my skeleton:
1) Preserve current path, add Hmg environment path and some compiler flags
2) Call hbmk2
3) Restore previous path

CODE 1)

Code: Select all

SET tpath=%PATH%
SET hmgpath=D:\HMG\MiniGui
SET PATH=%hmgpath%\util;%hmgpath%\mingw\bin;%hmgpath%\harbour\bin;
SET hmgres=%hmgpath%\resources\hmg.o
SET gui=-gtgui
SET mt=
SET prgflag=-prgflag=/q /w0 /es2
SET cflag=-cflag=-O3
N.B. you must do changes regarding your installation; I have installed HMG3 on partition D:

CODE 2)

Code: Select all

hbmk2 -o%~n1.exe %prgflag% %cflag% %gui% %mt% -incpath=%HmgPath%\include -L%HmgPath%\lib -lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32 %1 %hmgres% >hbmk.log 2>&1
IF ERRORLEVEL 1 GOTO error04
N.B.
A) I'm using stdout to create log file: look at ">hbmk.log 2>&1". I don't use redir like in build .bat
B) You can see "-l" flag with libraries names: I inserted the minimu required
C) Look at -incpath and -L and related vars
D) take a look to the %prgflag%, %cflag% etc. I've inserted into the .bat but can be inserted/altered inside "hbp"
E) take a look to the %hmgres% var: can store standard hmg.o file or your if I you have one compiled with "windres" command.

CODE 3)
sounds like cleanup

Code: Select all

SET PATH=%tpath%
SET tpath=
SET hmgpath=
SET hmgres=
SET gui=
SET mt=
SET prgflag=
SET cflag=
I hope this it's clear (take a look to the build.bat standard command) if not, I can send you complete version with PM.

Best regards.
Luigi from Italy
www.L3W.it
CCH4CLIPPER
Posts: 140
Joined: Tue Mar 03, 2009 8:59 am

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by CCH4CLIPPER »

Hi Luigi

Thanks again for a speedy response !

I get the idea... pretty complicated compared to using hbmk2 to compile a HB21 +gtWVG app ie just adding -gtWVG and gtGUI to myproject.hbp file and then just calling hbmk2 myproject.hbp :-)

Cheers

CCH
http://cch4clipper.blogspot.com
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by l3whmg »

Hi CCH,I'm sorry I dont's understand very well your replay :oops:

Any way if the problem is to have all options inside hbp, here is an example.hbp:

Code: Select all

-o${hb_targetname}.exe
-prgflag=-w3 -es2 -gtgui
-cflag=-O3
-incpath=D:\HMG\MiniGui\include
-L=D:\HMG\MiniGui\lib
-lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32

otherfile.hbc

prg1.prg
prg2.prg
...
and this can be batch command

Code: Select all

SET tpath=%PATH%
SET hmgpath=D:\HMG\MiniGui
SET PATH=%hmgpath%\util;%hmgpath%\mingw\bin;%hmgpath%\harbour\bin;
SET hmgres=%hmgpath%\resources\hmg.o
SET HB_TARGETNAME=%~n1

hbmk2 %1 %hmgres% >hbmk.log 2>&1

SET PATH=%tpath%
SET tpath=
SET hmgpath=
SET hmgres=
SET HB_TARGETNAME=
N.B.
A) in this way you have a fixed GUI; with .bat you can use/intercept a parameter and change. I don't know if there is the ability to give a parameter to the .hbp file!
B) HB_TARGETNAME is an environment var used in HBMK2 (there are many others!)
C) about resources there are many possibilities ( .rc or .o file) but I must investigate
D) hbmk2 can manage: .hbp, .hbm, .hbc At this moment I don't have a clear idea
E) with otherfile.hbc you can add extra libs and include

I think hbmk2 doc is very small and not clear (for me!)

Cheers
Luigi from Italy
www.L3W.it
CCH4CLIPPER
Posts: 140
Joined: Tue Mar 03, 2009 8:59 am

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by CCH4CLIPPER »

Hi Luigi

> -lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32

Are all the above libs necessary to compile a HMG app ?

CCH
http://cch4clipper.blogspot.com
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by l3whmg »

Hi CCH,
IMO yes. I created this list using the method of including step by step. I have found that:
- Hmg obviously :D
- hbmzip, hbct, hbmisc, xhb from Harbour pack
- vfw32, msvfw32 from MinGw pack

Maybe it's possible that someone is not essential for your program :?: , but you can try excluding one at a time.


In addition, I have tried to compile HMG3 with the new version of the Harbour compiler but I got many warning with the option /w0 (with /w3, of course, does not generate the hmg library). The generation of an executable is, in any case, impossible for many mistakes: for example with hbmzip (used by Hmg).

Cheers
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by l3whmg »

Hi CCH,
I have provided to you inaccurate information.
First: these libraries are required to use standard HMG.
Second: with HMG are also distributed other libraries: libcrypt, libedit, libeditex, libgraph, and so on. If you use commands that come from these libraries you must add them to the compilation command (ex. drawline() come from libgraph).
Third: Harbour adds other libraries, but I have not been able to discover the list :oops:

Cheers
Luigi from Italy
www.L3W.it
CCH4CLIPPER
Posts: 140
Joined: Tue Mar 03, 2009 8:59 am

Re: How to compile a HMG apps using Harbour hbmk2 ?

Post by CCH4CLIPPER »

Hi Luigi

I tried
frs4hmg.hbp
=========
-o${hb_targetname}.exe
-prgflag= -w3 -es2 -gtgui
-cflag=-O3

frs4hmg.hbc

-lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32

frs4w764.prg
locks.prg


frs4hmg.hbc
=========
incpaths=c:\hmg\include
libpaths=c:\hmg\lib
libs=
gt=
mt=no
instpaths=


Resultant Error Messages
===================


C:\hmg.3.0.35\PROJECTS\FRS4W764>hbmk2 frs4hmg.hbp

Harbour 2.1.0rc1 (Rev. 16282)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'frs4w764.prg'...
Lines 20466, Functions/Procedures 27
Generating C source output to 'C:\Users\CCH\AppData\Local\Temp\hbmk_dtvp0k.dir\f
rs4w764.c'... Done.
Compiling 'locks.prg'...
Lines 157, Functions/Procedures 4
Generating C source output to 'C:\Users\CCH\AppData\Local\Temp\hbmk_dtvp0k.dir\l
ocks.c'... Done.
c:/hb21/lib/win/mingw/libhbwin.a(legacycd.o):legacycd.c:(.text+0x0): multiple de
finition of `HB_FUN_GETLASTERROR'
c:/hmg/lib/libhmg.a(c_winapimisc.o):c_winapimisc.c:(.text+0xcbc): first defined
here
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x12): undefined referen
ce to `unzClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x48): undefined referen
ce to `zipClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x7b): undefined referen
ce to `unzOpen'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0xda): undefined referen
ce to `zipOpen'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x105): undefined refere
nce to `unzGetGlobalInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x12c): undefined refere
nce to `unzGoToFirstFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x158): undefined refere
nce to `unzGoToNextFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x19c): undefined refere
nce to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x220): undefined refere
nce to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x253): undefined refere
nce to `unzOpenCurrentFile2'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x26f): undefined refere
nce to `unzGetLocalExtrafield'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x29c): undefined refere
nce to `unzGetLocalExtrafield'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x385): undefined refere
nce to `zipOpenNewFileInZip2'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x3d8): undefined refere
nce to `zipWriteInFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x403): undefined refere
nce to `unzReadCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x476): undefined refere
nce to `zipClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x47e): undefined refere
nce to `unzClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x4cf): undefined refere
nce to `unzClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x4fe): undefined refere
nce to `zipCloseFileInZipRaw'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x50e): undefined refere
nce to `unzCloseCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x55e): undefined refere
nce to `unzGoToNextFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x5bf): undefined refere
nce to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x625): undefined refere
nce to `unzGetGlobalComment'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x6fa): undefined refere
nce to `zipClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x77e): undefined refere
nce to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x7a1): undefined refere
nce to `unzOpenCurrentFilePassword'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x85a): undefined refere
nce to `unzCloseCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x8e4): undefined refere
nce to `unzReadCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0xc54): undefined refere
nce to `zipOpen2'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0xd1d): undefined refere
nce to `zipClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0xfc2): undefined refere
nce to `zipOpenNewFileInZip3'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1133): undefined refer
ence to `zipWriteInFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1206): undefined refer
ence to `zipCloseFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1268): undefined refer
ence to `unzOpen'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x130c): undefined refer
ence to `unzClose'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1398): undefined refer
ence to `unzGetGlobalInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x13fb): undefined refer
ence to `unzGetGlobalComment'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x14e6): undefined refer
ence to `unzGoToFirstFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1556): undefined refer
ence to `unzGoToNextFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x15c6): undefined refer
ence to `unzGetOffset'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1647): undefined refer
ence to `unzSetOffset'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x16f9): undefined refer
ence to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x18bb): undefined refer
ence to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1ad7): undefined refer
ence to `unzOpenCurrentFilePassword'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1c00): undefined refer
ence to `unzReadCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1c46): undefined refer
ence to `unzCloseCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x1ef3): undefined refer
ence to `zipOpenNewFileInZip3'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2039): undefined refer
ence to `zipOpenNewFileInZip3'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x213c): undefined refer
ence to `zipWriteInFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x216b): undefined refer
ence to `zipCloseFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2207): undefined refer
ence to `zipCloseFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2440): undefined refer
ence to `zipOpenNewFileInZip3'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x24ce): undefined refer
ence to `zipWriteInFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2501): undefined refer
ence to `zipCloseFileInZip'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2642): undefined refer
ence to `unzGetCurrentFileInfo'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x2688): undefined refer
ence to `unzOpenCurrentFilePassword'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x26d1): undefined refer
ence to `unzReadCurrentFile'
c:/hb21/lib/win/mingw/libhbmzip.a(mzip.o):mzip.c:(.text+0x27a4): undefined refer
ence to `unzCloseCurrentFile'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
c:\hb21\comp\mingw\bin\gcc.exe C:/Users/CCH/AppData/Local/Temp/hbmk_dtvp0k.dir/f
rs4w764.o C:/Users/CCH/AppData/Local/Temp/hbmk_dtvp0k.dir/locks.o C:/Users/CCH/A
ppData/Local/Temp/hbmk_dtvp0k.dir/hbmk_jkjf91.o -mwindows -Wl,--start-group -
lhmg -lhbmzip -lhbwin -lhbct -lhbmisc -lxhb -lvfw32 -lmsvfw32 -lhbextern -lhbdeb
ug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lg
tgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -
lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luse
r32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luui
d -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre
-lhbzlib -Wl,--end-group -ofrs4hmg.exe -Lc:/hb21/lib/win/mingw -Lc:/hb21/bin
-Lc:/hmg/lib

Any suggestions ?


CCH
http://cch4clipper.blogspot.com
Last edited by CCH4CLIPPER on Wed Feb 16, 2011 7:22 am, edited 1 time in total.
Post Reply