Error compiling using hbmk2 + mingw + FWH11.8

Error compiling using hbmk2 + mingw + FWH11.8

Postby hua » Sat Sep 24, 2011 7:51 pm

Hi guys,
Now playing around with hbmk2 (harbour rev 17047) + mingw + fwh11.8.

I try to compile the following piece of code
Code: Select all  Expand view

#include "fivewin.ch"
function ud_origin()
 local cExePath := getmodulefilename(getinstance())
   ? cExePath
   ? getwindir()
   ? len("C:\Program Files (x86)\Common Files\microsoft shared\Virtualization Handler\CVH.EXE   Microsoft Excel Starter 2010 9014006604090000")
   ? os_versioninfo()
   ? GetEnv("UserPRofile")
   ? OS_VersionInfo()[1]
   ? valtype(OS_VersionInfo()[1])
return cExePath


I compile using the syntax:
Code: Select all  Expand view

D:\fwh\samples>hbmk2 hua3   xhb.hbc d:\fwh\fwh.hbc


But I got this error instead
Code: Select all  Expand view

Harbour 3.1.0dev (Rev. 17047)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'hua3.prg'...
Lines 3808, Functions/Procedures 1
Generating C source output to 'C:\Users\hua\AppData\Local\Temp\hbmk_fxk1jg.dir\hua3.c'... Done.
d:/fwh/lib/fivehg.lib(gettasks.o):gettasks.c:(.text+0x83): undefined reference to `GetModuleFileNameExA@16'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe C:/Users/hua/AppData/Local/Temp/hbmk_fxk1jg.dir/hua3.o C:/Users/hua/AppData/Local/Temp/hbmk_fxk1jg.dir/hbmk_rxlyrf.o    -mwindows -Wl,--start-group -lxhb -lhbct -lhbtip -lhbwin -lpng -lhbfship -lhbxpp -lfi
vehg -lfivehgc -lcomctl32 -lcomdlg32 -lgdi32 -lhbcplr -lhbmzip -lhbpcre -lhbsqlit3 -lhbzlib -lmsimg32 -lodbc32 -lole32 -loleaut32 -luser32 -luuid -lvfw32 -lwinmm -lwinspool -lwsock32 -lhbextern -lhbdebug -lhbvm -l
hbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -
lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib   -Wl,--end-group -ohua3.exe
  -Ld:/harbour/lib/win/mingw -Ld:/harbour/bin/win/mingw -Ld:/fwh/lib


I would also appreciate if someone would like to share tips on how to control the sequence of include dir to search and sequence of libs to link when using hbmk2.

TIA
Last edited by hua on Sun Sep 25, 2011 5:04 pm, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Error compiling using hbmk2 + mingw + FWH.8

Postby Antonio Linares » Sat Sep 24, 2011 8:37 pm

Hua,

Please post the contents of xhb.hbc and fwh.hbc, thanks

Here fwh\samples\buildg.bat is working fine building this code:

hua.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

  local oWnd

  DEFINE WINDOW oWnd

  MsgInfo( GetWindowModuleFileName( oWnd:hWnd ) )

  ACTIVATE WINDOW oWnd

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error compiling using hbmk2 + mingw + FWH11.8

Postby hua » Sat Sep 24, 2011 9:08 pm

Just a note, after replacing MingW (TDM-GCC) with BCC5.82 everything works as it should. Maybe all this happened cause I used MingW from http://tdm-gcc.tdragon.net/ ? I didn't test with buildg.bat as I was hoping to make use of .hbp files. Maybe I'll try that later on.

Here's my fwh.hbc
Code: Select all  Expand view

#
# $Id: fwh.hbc 11227 2009-06-05 16:55:43Z vszakats $
#

# Copy this file to FWH root dir and include it in hbmk2
# command line to build an app:
# > hbmk2 test.prg C:\fwh\fwh.hbc


{win}incpaths=include
{win}libpaths=lib

{win}gt=gtgui

{mingw}libs=fivehg fivehgc
{bcc}libs=fiveh fivehc
{win}libs=xhb
{win}libs=hbwin
{win}libs=comctl32
{win}libs=comdlg32
{win}libs=gdi32
{win}libs=hbcplr
{win}libs=hbct
{win}libs=hbmzip
{win}libs=hbpcre
{win}libs=hbsqlit3
{win}libs=hbtip
{win}libs=hbwin
{win}libs=hbzlib
{win}libs=msimg32
{win}libs=odbc32
{win}libs=ole32
{win}libs=oleaut32
{win}libs=user32
{win}libs=uuid
{win}libs=vfw32
{win}libs=winmm
{win}libs=winspool
{win}libs=psapi
{win}libs=wsock32


xhb.hbc
Code: Select all  Expand view

#
# $Id: xhb.hbc 16796 2011-05-19 17:00:41Z vszakats $
#

incpaths=.

libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}

# xhb has these as part of core, so we're adding them to emulate it.
# They are not needed to use xhb lib itself.
libs=../hbct/hbct.hbc
libs=../hbtip/hbtip.hbc
libs=../hbwin/hbwin.hbc
libs=../hbfship/hbfship.hbc
libs=../hbxpp/hbxpp.hbc


Thanks for the prompt reply Antonio :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Error compiling using hbmk2 + mingw + FWH.8

Postby hua » Sat Sep 24, 2011 9:32 pm

After the success in compiling my test code when I use BCC, I tried to compile samples\rbdesign.prg and I got this:

Code: Select all  Expand view
D:\fwh\samples>hbmk2 rbdesign   xhb.hbc d:\fwh\fwh.hbc
Harbour 3.1.0dev (Rev. 17047)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'rbdesign.prg'...
Lines 4670, Functions/Procedures 22
Generating C source output to 'C:\Users\hua\AppData\Local\Temp\hbmk_56q5pv.dir\rbdesign.c'... Done.
C:\Users\hua\AppData\Local\Temp\hbmk_56q5pv.dir\rbdesign.c:
Error E2451 rbdesign.prg 589: Undefined symbol 'LONG' in function HB_FUN_FREOPEN_STDERR
Error E2121 rbdesign.prg 589: Function call missing ) in function HB_FUN_FREOPEN_STDERR
*** 2 errors in Compile ***
C:\Users\hua\AppData\Local\Temp\hbmk_uhf2wc.c:
hbmk2: Error: Running C/C++ compiler. 1
bcc32.exe -c -q -d -6 -O2 -OS -Ov -Oi -Oc  -tW -tWM -w -Q -w-sig- -nC:\Users\hua\AppData\Local\Temp\hbmk_56q5pv.dir -Id:\bcc582\Include -Id:\bcc582\Include\dinkumware -Id:\harbour\include -Id:\harbour\contrib\xhb
-Id:\harbour\contrib\hbct -Id:\harbour\contrib\hbtip -Id:\harbour\contrib\hbwin -Id:\harbour\contrib\hbfship -Id:\harbour\contrib\hbxpp -Id:\fwh\include C:\Users\hua\AppData\Local\Temp\hbmk_56q5pv.dir\rbdesign.c
:\Users\hua\AppData\Local\Temp\hbmk_uhf2wc.c
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Error compiling using hbmk2 + mingw + FWH.8

Postby Antonio Linares » Sat Sep 24, 2011 10:15 pm

Hua,

You have to replace LONG with HB_LONG
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error compiling using hbmk2 + mingw + FWH11.8

Postby hua » Sun Sep 25, 2011 5:08 pm

Antonio, using the latest libs that you e-mailed me, a copy of official MingW (just in case) and an edited fwh.hbc everything now seems to compile smoothly :)

Here's the updated fwh.hbc
Code: Select all  Expand view

#
# $Id: fwh.hbc 11227 2009-06-05 16:55:43Z vszakats $
#

# Copy this file to FWH root dir and include it in hbmk2
# command line to build an app:
# > hbmk2 test.prg C:\fwh\fwh.hbc


{win}incpaths=include
{win}libpaths=lib

{win}gt=gtgui

{mingw}libs=fivehg fivehgc
{bcc}libs=fiveh fivehc
{win}libs=comctl32
{win}libs=comdlg32
{win}libs=gdi32
{win}libs=hbcplr
{win}libs=hbct
{win}libs=hbmzip
{win}libs=hbpcre
{win}libs=hbsqlit3
{win}libs=hbtip
{win}libs=hbwin
{win}libs=hbzlib
{mingw}libs=kernel32
{mingw}libs=mfcuia32
{win}libs=msimg32
{win}libs=odbc32
{win}libs=ole32
{win}libs=oleaut32
{win}libs=oledlg
{win}libs=psapi
{mingw}libs=stdc++
{win}libs=user32
{win}libs=uuid
{mingw}libs=version
{win}libs=vfw32
{mingw}libs=win32k
{win}libs=winmm
{win}libs=winspool
{win}libs=wsock32
{win}libs=xhb

#Harbour core libs which shouldn't be manually added
#---------------------------------------------------
#gtcgi
#gtcrs
#gtgui
#gtos2
#gtpca
#gtsln
#gtstd
#gttrm
#gtwin
#gtwvt
#gtxwc
#hbcommon
#hbcpage
#hbextern
#hbhsx
#hblang
#hbmacro
#hbmaindllh
#hbmainstd
#hbmainwin
#hbpp
#hbrdd
#hbrtl
#hbsix
#hbusrrdd
#hbvm
#hbvmmt
#rddcdx
#rddfpt
#rddnsx
#rddntx


List of what is core harbour libs was gleaned from this post: http://groups.google.com/group/harbour- ... 3ceb7dc993

Anyone knows what's the rule of thumb to determine whether a lib is a core harbour lib or not?
Last edited by hua on Mon Sep 26, 2011 12:38 pm, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Error compiling using hbmk2 + mingw + FWH11.8

Postby Antonio Linares » Sun Sep 25, 2011 7:05 pm

Hua,

The rule is to check if you have unresolved externals :-)

Many thanks for your great feeback!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Marc Venken, Silvio.Falconi and 87 guests