Page 1 of 3
Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Tue Apr 19, 2022 6:00 am
by Antonio Linares
Using hbmk2.exe to build our FWH app 32 bits using Microsoft Visual Studio Community 2022:
test.hbp
Code: Select all | Expand
-gui
-Ic:\fwh\include
test.prg
-Lc:\fwh\lib
-lFiveH32
-lFiveHC32
-lgdiplus
-lole32
-lOleDlg
-lversion
xhb.hbc
hbct.hbc
hbwin.hbc
hbmzip.hbc
hbziparc.hbc
hbfoxpro.hbc
-ldflag=/NODEFAULTLIB:msvcrt
test.rc
go32.bat
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
c:\harbour\bin\hbmk2 test.hbp -comp=msvc
test.exe
test.prg
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oBmpTiled, oWnd, oMsgBar
DEFINE BITMAP oBmpTiled RESOURCE "background"
DEFINE WINDOW oWnd MENU BuildMenu() TITLE "My app"
BuildBar( oWnd )
DEFINE MSGBAR oMsgBar OF oWnd PROMPT "My app" NOINSET
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT DrawTiled( hDC, oWnd, oBmpTiled )
oBmpTiled:End()
return nil
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Files"
ENDMENU
return oMenu
function BuildBar( oWnd )
local oBar
DEFINE BUTTONBAR oBar OF oWnd 3D SIZE 70, 70
return nil
test.rc
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Tue Apr 19, 2022 7:13 am
by Antonio Linares
64 bits version using FWH 64 and MSVC 64 bits:
test64.hbp
Code: Select all | Expand
-gui
-Ic:\fwh\include
test.prg
-Lc:\fwh\lib
-lFiveH64
-lFiveHC64
-lgdiplus
-lole32
-lOleDlg
-lversion
xhb.hbc
hbct.hbc
hbwin.hbc
hbmzip.hbc
hbziparc.hbc
hbfoxpro.hbc
-ldflag=/NODEFAULTLIB:msvcrt
test.rc
go64.bat
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
c:\harbour\bin\hbmk2 test64.hbp -comp=msvc64
test.exe
test.prg (same code as previous msg)
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oBmpTiled, oWnd, oMsgBar
DEFINE BITMAP oBmpTiled RESOURCE "background"
DEFINE WINDOW oWnd MENU BuildMenu() TITLE "My app"
BuildBar( oWnd )
DEFINE MSGBAR oMsgBar OF oWnd PROMPT "My app" NOINSET
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT DrawTiled( hDC, oWnd, oBmpTiled )
oBmpTiled:End()
return nil
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Files"
ENDMENU
return oMenu
function BuildBar( oWnd )
local oBar
DEFINE BUTTONBAR oBar OF oWnd 3D SIZE 70, 70
return nil
test.rc
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 6:45 am
by Horizon
Hi Antonio,
What is the advantage of hbmk2.exe?
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 9:53 am
by Antonio Linares
Hakan,
Simplicity and easy of use
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 11:24 am
by vilian
Good Morning Antonio,
I can´t find download for MSVC 2019. Could I try it with MSVC 2022?
Which option should us choose in this screen?
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 4:48 pm
by Antonio Linares
Vilian,
> Could I try it with MSVC 2022 ?
Please use 2022
Please select "desenvolvimiento para desktop com C++"
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 5:25 pm
by vilian
Thank you Antonio,
I'm tryng to compile a little samples, but it's showing the error message bellow:
Code: Select all | Expand
[vcvarsall.bat] Environment initialized for: 'x86'
hbmk2[testsql07]: Warning: Cannot find xhb.hbc (referenced from testsql07.hbp)
hbmk2[testsql07]: Warning: Cannot find hbct.hbc (referenced from testsql07.hbp)
hbmk2[testsql07]: Warning: Cannot find hbwin.hbc (referenced from testsql07.hbp)
hbmk2[testsql07]: Warning: Cannot find hbmzip.hbc (referenced from testsql07.hbp)
hbmk2[testsql07]: Warning: Cannot find hbziparc.hbc (referenced from testsql07.hbp)
hbmk2[testsql07]: Warning: Cannot find hbfoxpro.hbc (referenced from testsql07.hbp)
I'm using this content into testsql07.hbp:
Code: Select all | Expand
-gui
-Ic:\fwh21\include
testsql07.prg
-Lc:\fwh21\lib
-lFiveH32
-lFiveHC32
-lgdiplus
-lole32
-lOleDlg
-lversion
xhb.hbc
hbct.hbc
hbwin.hbc
hbmzip.hbc
hbziparc.hbc
hbfoxpro.hbc
-ldflag=/NODEFAULTLIB:msvcrt
Where can i find these files that are missing?
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 5:27 pm
by Antonio Linares
Vilian,
Please do this:
git clone
https://github.com/harbour/core harbour
so it gets cloned at c:\harbour
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Wed Apr 20, 2022 6:04 pm
by vilian
Thank you
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Thu Apr 21, 2022 2:15 pm
by csincuir
Hola Antonio,
He seguido los pasos que indicas, pero tengo el siguiente error, usando el test.prg:
Que no encuentra la funcion BuildMenu()
Estoy utilizando el Harboour de MSVC20201019, Visual Studio 2022 y FWH22.03
Saludos
Carlos.
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Thu Apr 21, 2022 8:46 pm
by csincuir
Ya esta solucionado Antonio.
Le cambie el nombre a la funcion BuildMenu de tu Ejemplo a MenuSis y enlazo correctamente, y genero el ejecutable sin problema
No se porque no encontraba la funcion con el nombre original?
Saludos cordiales
Carlos
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Fri Apr 22, 2022 6:35 am
by Antonio Linares
Carlos,
Ya habiamos detectado ese bug y está arreglado para el próximo build de FWH
Efectivamente la solución es cambiar el nombre de la función BuildMenu()
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Fri Apr 22, 2022 6:10 pm
by csincuir
Enterado Antonio, gracias.
Seguiré ahora con tratar de armar un proyecto que ya tengo funcionando con Borland, y que quiero ahora tener con MSVC.
Saludos
Carlos.
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Sat Apr 23, 2022 8:39 am
by Horizon
Hi Antonio,
After cloning, what should I do? There is not any binary file bin directory. Should I compile? How?
Thanks.
Re: Build your FWH app using hbmk2.exe and MSVC 32&64
Posted: Sat Apr 23, 2022 10:42 am
by Antonio Linares
Dear Hakan,
Please use these batch files to build Harbour 32 and 64 bits using Visual Studio Community 2022:
copy them into c:\harbour
You have to download OpenSSL 32 and 64 bits from here:
https://slproweb.com/products/Win32OpenSSL.html and
curl from here:
https://curl.se/download.htmlgo32.bat
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
set HB_COMPILER=msvc
set HB_BUILD_MODE=c
set HB_USER_PRGFLAGS=-l-
set HB_BUILD_CONTRIBS
rem set HB_BUILD_DEBUG=yes
rem set HB_TR_LEVEL=debug
rem set HB_USER_CFLAGS=-DHB_TR_LEVEL_DEBUG
set HB_WITH_OPENSSL=c:\OpenSSL-Win32\include
set HB_WITH_CURL=c:\curl\include
set HB_OPENSSL_STATIC=yes
set HB_STATIC_OPENSSL=yes
set HB_STATIC_CURL=yes
set HB_WITH_LIBHARU
set HB_BUILD_DYN=no
set HB_BUILD_CONTRIB_DYN=no
del .\src\common\obj\win\msvc\hbver.obj
del .\src\common\obj\win\msvc\hbver_dyn.obj
del .\src\common\obj\win\msvc\hbverdsp.obj
win-make.exe
copy c:\harbour\lib\win\msvc\libcurl-x32.lib c:\harbour\lib\win\msvc\libcurl.lib
copy c:\harbour\lib\win\msvc\libssl-1_1-x32.lib c:\harbour\lib\win\msvc\ssleay32.lib
copy c:\harbour\lib\win\msvc\libcrypto-1_1-x32.lib c:\harbour\lib\win\msvc\libcrypto.lib
go64.bat
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
set HB_COMPILER=msvc64
set HB_BUILD_MODE=c
set HB_USER_PRGFLAGS=-l-
set HB_BUILD_CONTRIBS
rem set HB_BUILD_DEBUG=yes
rem set HB_TR_LEVEL=debug
rem set HB_USER_CFLAGS=-DHB_TR_LEVEL_DEBUG
set HB_WITH_OPENSSL=c:\OpenSSL-Win64\include
set HB_WITH_CURL=c:\curl\include
set HB_OPENSSL_STATIC=yes
set HB_STATIC_OPENSSL=yes
set HB_STATIC_CURL=yes
set HB_WITH_LIBHARU
set HB_BUILD_DYN=no
set HB_BUILD_CONTRIB_DYN=no
del .\src\common\obj\win\msvc64\hbver.obj
del .\src\common\obj\win\msvc64\hbver_dyn.obj
del .\src\common\obj\win\msvc64\hbverdsp.obj
win-make.exe
copy c:\harbour\lib\win\msvc64\libcurl-x64.lib c:\harbour\lib\win\msvc64\libcurl.lib
copy c:\harbour\lib\win\msvc64\libssl-1_1-x64.lib c:\harbour\lib\win\msvc64\ssleay32.lib
copy c:\harbour\lib\win\msvc64\libcrypto-1_1-x64.lib c:\harbour\lib\win\msvc64\libcrypto.lib