Testzip and Testuzip will not compile

Post Reply
Vytas
Posts: 25
Joined: Sun Oct 23, 2005 9:58 pm

Testzip and Testuzip will not compile

Post by Vytas »

Hi

I run the standard Buildh.bat on either Testzip.prg or Testuzip and get multiple Unresolved externals error messages similar to example below.

Any idea what I am missing? All other Test*.prg I compiled with Buildh.bat compile fine.

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_UNZIPFILE' referenced from D:\FWH\SAMPLES\TSTUZIP.OBJ

snip ...

Could Not Find D:\FWH\SAMPLES\testuzip.il?

Thanks,

Vytas
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Testzip and Testuzip will not compile

Post by Richard Chidiak »

Vytas wrote:Hi

I run the standard Buildh.bat on either Testzip.prg or Testuzip and get multiple Unresolved externals error messages similar to example below.

Any idea what I am missing? All other Test*.prg I compiled with Buildh.bat compile fine.

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_UNZIPFILE' referenced from D:\FWH\SAMPLES\TSTUZIP.OBJ

snip ...

Could Not Find D:\FWH\SAMPLES\testuzip.il?

Thanks,

Vytas
Zip and unzip are 16 bits programs, they will not work with harbour/xharbour.

You must use hbzip instead available for harbour and xharbour.

Check at www.xharbour.org

Richard
Vytas
Posts: 25
Joined: Sun Oct 23, 2005 9:58 pm

Post by Vytas »

Thanks Richard,

I downloaded the contribution libs from Xharbour and put the hbzip.lib into directory d:\harbour\lib. Modified my rmk file it include hbzip.lib as follows.

HBDIR=d:\harbour
BCDIR=d:\Borland\bcc55
FWDIR=d:\fwh

snip ...

echo $(HBDIR)\lib\codepage.lib + >> b32.bc
echo $(HBDIR)\lib\hbzip.lib + >> b32.bc

snip ...

In testing I added the following line to my function

LOCAL oZipFile := ZipNew()

The compile seems to run fine, however on linking I get the following error.

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPNEW' referenced from T:\T1\PRG\OBJ\CTI.OBJ

Any idea of what I am missing? Do I need some additional libs or is something else missing?

Thanks,

Vytas
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Vytas wrote:Thanks Richard,

I downloaded the contribution libs from Xharbour and put the hbzip.lib into directory d:\harbour\lib. Modified my rmk file it include hbzip.lib as follows.

HBDIR=d:\harbour
BCDIR=d:\Borland\bcc55
FWDIR=d:\fwh

snip ...

echo $(HBDIR)\lib\codepage.lib + >> b32.bc
echo $(HBDIR)\lib\hbzip.lib + >> b32.bc

snip ...

In testing I added the following line to my function

LOCAL oZipFile := ZipNew()

The compile seems to run fine, however on linking I get the following error.

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPNEW' referenced from T:\T1\PRG\OBJ\CTI.OBJ

Any idea of what I am missing? Do I need some additional libs or is something else missing?

Thanks,

Vytas
:D

Vytas,

This is a snapshot of my backup/restore program using hbzzip/unzip wuith meter progress, Comments ae in french, if you need help, let me know

Richard

DEFINE DIALOG oDlg NAME "ZIP"

REDEFINE SAY oSource PROMPT cpath ID 101 OF oDlg
REDEFINE SAY oTarget PROMPT cDEST ID 102 OF oDlg
REDEFINE GET OFILE VAR DFILE ID 103 OF ODLG READONLY UPDATE COLOR CLR_BLUE

REDEFINE METER oMEtEr VAR nPerc1 ID 150 OF oDlg TOTAL 100

REDEFINE BUTTON OBTNOK ID 01 OF oDlg ;
ACTION (OBTNOK:DISABLE(),OBTNCAN:DISABLE(),ZIPME(OMETER,cPATH,CDEST,@LSAVE,SOUSREP,ODLG,@DFILE,OFILE))

REDEFINE BUTTON OBTNCAN ID 02 OF oDlg ;
ACTION LSAVE := .F., oDlg:end()

ACTIVATE DIALOG oDlg CENTERED

IF LSAVE
ECRSTAT("S")
ENDIF
RETURN NIL

STATIC FUNCTION ZIPME(OMETER,cPATH,CDEST,LSAVE,SOUSREP,ODLG,DLGFILE,OBJFILE)

LOCAL aFiles := {}, ;
lZipWithPath := .t., ;
lZipDone := .T.

LOCAL aDir := DIRECTORY(CURDRIVE() + ":" + CURDIR() + "\*.*","D")
LOCAL NCTR := 0
LOCAL NLEN := 0, ;
CZIP

MSGINFO("Veuillez insérer votre disque dans le lecteur")

cZip := CDEST + "DATA.ZIP"

IF FILE("DATA.ZIP")
ERASE "DATA.ZIP"
ENDIF

IF FILE(CZIP)
ERASE (CZIP)
ENDIF

FillFiles( @aFiles, aDir, cPath,SOUSREP )

nLEN := len(afiles)

lZipDone := HB_ZIPFILE( cZip , aFiles , 9, {|cFile,nPos| UPDMETER(CFILE,OMETER,NPOS,@nctr,NLEN,ODLG,@DLGFILE,OBJFILE)}, ;
.T.,, lZipWithPath, .F. )

IF ! lZipdone
ALERT("Erreur création fichier Zip " )
RETURN NIL
ENDIF

CDEST := CURDRIVE() + ":" + CURDIR() + "\DATA.ZIP"

erase (cdEST)
COPY FILE (CZIP) TO (CDEST)

tone( 500,1 )
tone( 600,1 )
tone( 700,1 )
MSGINFO("Sauvegarde terminée")

LSAVE := .T.
ODLG:END()
RETURN NIL

STATIC Function FillFiles( aFiles, cDir, cPath,SOUSREP )
LOCAL aSubDir,cItem,LEXT
FOR EACH cItem IN cDir
IF cItem[5] <> "D"
LEXT := ALLTRIM(CITEM[1])
LEXT := SUBS(LEXT,LEN(LEXT) -2 ,3)
IF UPPER(CITEM[1]) # "DATA.ZIP" .AND. UPPER(CITEM[1]) # "PRO99.EXE" ;
.AND. UPPER(CITEM[1]) # "CBATIWIN.EXE" .AND. UPPER(CITEM[1]) # "XHBZIPDLL.DLL" ;
.AND. UPPER(LEXT) # "DLL" .AND. UPPER(LEXT) # "EXE" .AND. UPPER(LEXT) # "ZIP"
SETFILEATTRIBUTES(cPath+cItem[1], FILE_ATTRIBUTE_ARCHIVE )
AADD( aFiles, cPath+cItem[1] )
ENDIF
ELSEIF cItem[1] <> "." .AND. cItem[1] <> ".."
IF SOUSREP
aSubDir := DIRECTORY( cPath+cItem[1]+"\*.*", "D" )
aFiles := FillFiles( aFiles ,aSubdir , cPath+cItem[1]+"",SOUSREP )
ENDIF
ENDIF
NEXT
RETURN aFiles

DLL32 FUNCTION SETFILEATTRIBUTES(cFileName AS LPSTR, nFileAttributes AS DWORD ) ;
AS BOOL PASCAL FROM "SetFileAttributesA" LIB "Kernel32.dll"

STATIC FUNCTION UPDMETER(CFILE,OMETER,NPOS,nctr,NLEN,ODLG,DLGFILE,OBJFILE)
NCTR++
DLGFILE := CFILE + SPACE(30)
OBJFILE:REFRESH()
ometer:set(nCTR * 100 / NLEN)
sysrefresh()
return nil

//----------------------------------------------------------------------------//

FUNCTION REST(fico)

LOCAL SOUSREP := .F., ;
cPath := CURDRIVE()+":"+CURDIR()+"", ;
NPERC1 := 0, ;
LSAVE := .F., ;
DFILE := SPACE(80), ;
ODLG,OMETER,OFILE,CZIP,Osource,Otarget,OBTNOK,OBTNCAN

LOCAL cIniFile := GetWinDir()+"\CBATI.CFG"

IF ! FILE("DEVZIP.DBF")
IF ! CUTILZIP()
RETURN NIL
ENDIF
ENDIF

CZIP := GetPvProfString("USER","SAUVEGARDE",,CINIFile )

IF CZIP = " " .OR. CZIP = NIL .OR. CZIP < "A" .OR. CZIP > "Z"
IF FILE("DEVPILOT.DBF")
IF ! NETOPEN("DEVPILOT")
RETURN NIL
ENDIF
CZIP := SUBS(DEVPILOT->PARAM2,41,1)
SOUSREP := SUBS(DEVPILOT->PARAM2,58,1)
WRITEPPROSTRING("USER" ,"SAUVEGARDE" ,CZIP , cIniFile )
CZIP := GetPvProfString("USER","SAUVEGARDE",,CINIFile )
WRITEPPROSTRING("USER" ,"SAUVESDIR" ,SOUSREP , cIniFile )
SOUSREP := .F.
ENDIF
ENDIF

DBCLOSEALL()

MSGINFO("Attention, Vous demandez d'écraser vos fichiers actuels" + ;
CRLF + "Par votre sauvegarde, veuillez reconfirmer")

IF ! MSGYESNO("Voulez-vous vraiment restituer sur disque votre sauvegarde ?", ;
"Veuillez reconfirmer")
RETURN NIL
ENDIF

IF CZIP = "A"
MSGSTOP("Sauvegarde sur disquettes non supportée")
RETURN NIL
ENDIF

IF CZIP == " "
MSGSTOP("Lecteur non identifié, restitution impossible")
RETURN NIL
ENDIF

CZIP += ":\DATA.ZIP"

MSGINFO("Veuillez insérer votre disque de sauvegarde")

IF ! FILE( cZip )
ALERT("Fichier Zip introuvable ! ")
RETURN NIL
ENDIF

DEFINE DIALOG oDlg RESOURCE "unzip"

REDEFINE SAY oSource PROMPT cZIP ID 101 OF oDlg
REDEFINE SAY oTarget PROMPT cPATH ID 102 OF oDlg

REDEFINE GET OFILE VAR DFILE ID 103 OF ODLG READONLY UPDATE COLOR CLR_HRED

REDEFINE METER oMEtEr VAR nPerc1 ID 150 OF oDlg TOTAL 100

REDEFINE BUTTON OBTNOK ID 01 OF oDlg ;
ACTION (OBTNOK:DISABLE(),OBTNCAN:DISABLE(),UNZIPME(CZIP,OMETER,cPATH,@LSAVE,SOUSREP,ODLG,@DFILE,OFILE))

REDEFINE BUTTON OBTNCAN ID 02 OF oDlg ;
ACTION LSAVE := .F., oDlg:end()

ACTIVATE DIALOG oDlg CENTERED

IF LSAVE
ECRSTAT("R")
ENDIF

tone( 500,1 )
tone( 600,1 )
tone( 700,1 )
MSGINFO("Restitution terminée")
RETURN NIL

STATIC FUNCTION UNZIPME(CZIP,OMETER,cPATH,LSAVE,SOUSREP,ODLG,DLGFILE,OBJFILE)
LOCAL cCurdir, cZipDir, ;
lZipWithPath := .T., ;
aFiles := {}, ;
NCTR := 0, ;
NLEN := 0

aFiles := hb_GetFilesInZip( CZIP ,.t.)
nLEN := len(afiles)

cCurdir:=cZipdir:=CURDRIVE()+":"+CURDIR()+""
SwitchDir("")
cZipdir:="."

IF ! HB_UNZIPFILE( cZip, {|cFile,nPos| UPDMETER(CFILE,OMETER,NPOS,@nctr,NLEN,ODLG,@DLGFILE,OBJFILE)}, lZipWithPath,, cZipdir )
ALERT("Erreur décompression fichiers")
RETURN NIL
ELSE
LSAVE := .T.
ENDIF
SwitchDir( cCurdir )
ODLG:END()
RETURN NIL

STATIC FUNCTION SwitchDir( cDir )
LOCAL nError:=0

nError:=DIRCHANGE( cDir )
SWITCH nError
CASE 0
EXIT
CASE -1
ALERT("Mauvais Paramètre")
EXIT
CASE 3
ALERT( "Ce dossier n'esiste pas "+cDir )
EXIT
CASE 5
ALERT("Accès refusé au dossier "+cDir )
EXIT
DEFAULT
ALERT( "Erreur inconnue : "+ALLTRIM( STR( nError ) )+" pour "+cDir )
END
IF nError <> 0
RETURN NIL
ENDIF
RETURN NIL
Vytas
Posts: 25
Joined: Sun Oct 23, 2005 9:58 pm

Post by Vytas »

I have added hbzip.lib that I downloaded from the xharbour site to my harbour\lib directory. I modified the default Buildh.bat file to add "echo %hdir%\lib\hbzip.lib + >> b32.bc".

Running the compile/link batch still give me the following errors. Should not adding the hbzip.lib file provide the missing functions or is there another lib file I require?

Borland Resource Compiler Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation. All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPFILE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPTYPE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPBLOCK' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPMSG' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ

Thanks for the sample zip/unzip program. I noticed that you have the function names all starting with HB_ while the Fivewin samples do not. Why? I tried modifying the sample program using the HB_ prefix however it still will not link.

Surely I am missing something very basic.

Thanks again.
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Vytas wrote:I have added hbzip.lib that I downloaded from the xharbour site to my harbour\lib directory. I modified the default Buildh.bat file to add "echo %hdir%\lib\hbzip.lib + >> b32.bc".

Running the compile/link batch still give me the following errors. Should not adding the hbzip.lib file provide the missing functions or is there another lib file I require?

Borland Resource Compiler Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation. All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPFILE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPTYPE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPBLOCK' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPMSG' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ

Thanks for the sample zip/unzip program. I noticed that you have the function names all starting with HB_ while the Fivewin samples do not. Why? I tried modifying the sample program using the HB_ prefix however it still will not link.

Surely I am missing something very basic.

Thanks again.
Vytas

Forget about the fivewin sample for zipping and unzipping, they are only for 16 bits, they do not work in 32 bits environment. The function name is HB_ZIPFILE. Try to use my sample and i am sure you will make it.

Regards

Richard
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Vytas wrote:I have added hbzip.lib that I downloaded from the xharbour site to my harbour\lib directory. I modified the default Buildh.bat file to add "echo %hdir%\lib\hbzip.lib + >> b32.bc".

Running the compile/link batch still give me the following errors. Should not adding the hbzip.lib file provide the missing functions or is there another lib file I require?

Borland Resource Compiler Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation. All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPFILE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPTYPE' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPBLOCK' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPMSG' referenced from D:\FWH\SAMPLES\TESTZIP.OBJ

Thanks for the sample zip/unzip program. I noticed that you have the function names all starting with HB_ while the Fivewin samples do not. Why? I tried modifying the sample program using the HB_ prefix however it still will not link.

Surely I am missing something very basic.

Thanks again.
Try this very easy sample and let me know

#INCLUDE "FiveWin.ch"
/*
Sample for zipping files with Fivewin and xharbour

You need hbzip.lib and xhbzipdll.lib that you can download from www.xharbour.org

In your working directory you need xhbzipdll.dll that you can download from the same url

This is an original program written by my friend Sylvain Robert and reviewed by me

*/

FUNCTION Main()

LOCAL aDir := DIRECTORY( "*.*","D" ), aFiles:= {}, lZipWithPath:= .t.
LOCAL cPath := CURDRIVE()+":"+CURDIR()+"",lZipDone,DID

czip := "e:\test.zip" // MAKE CHANGE IF NEEDED

FillFiles( aFiles, aDir, cPath )
IF UPPER( LEFT( cZip, 2 ) ) <> "A:"

lZipDone:= HB_ZIPFILE( cZip , aFiles , 9, { |cFile,npos| QOUT( cFile ) }, ;
.T.,, lZipWithPath, .F. )
ELSE
HB_SETDISKZIP({|x| ALERT("Please Insert Disk No:"+ ALLTRIM( STR( x,3 ) ) ) } )
lZipDone:= HB_ZIPFILEBYPKSPAN( cZip , aFiles , 9, { |cFile,npos| QOUT( cFile ) }, ;
.T.,, lZipWithPath, .F. )
ENDIF
IF ! lZipdone
ALERT( "Zip file not created" )
ENDIF
RETURN NIL

FUNCTION FillFiles( aFiles, cDir, cPath )
LOCAL aSubDir,cItem

FOR EACH cItem IN cDir
IF cItem[5] <> "D"
AADD( aFiles, cPath+cItem[1] )
ELSEIF cItem[1] <> "." .AND. cItem[1] <> ".."
aSubDir := DIRECTORY( cPath+cItem[1]+"\*.*", "D" )
aFiles:=FillFiles( aFiles ,aSubdir , cPath+cItem[1]+"" )
ENDIF
NEXT
RETURN aFiles
Vytas
Posts: 25
Joined: Sun Oct 23, 2005 9:58 pm

Post by Vytas »

Hi Richard,

I googled and searched the xHarbour site and could not find reference to the file called xhbzipdll.lib. Can you please point me to where you got it.

Thanks for your patience.

Vytas
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Vytas wrote:Hi Richard,

I googled and searched the xHarbour site and could not find reference to the file called xhbzipdll.lib. Can you please point me to where you got it.

Thanks for your patience.

Vytas
:)
http://www.xharbour.org/download.asp?fi ... .bcc32.zip
Vytas
Posts: 25
Joined: Sun Oct 23, 2005 9:58 pm

Post by Vytas »

Hi Richard,

The link you provided to me is where I found the hbzip.lib file however the xhbzipdll.lib is not in the zip file.

Thinking that they renamed it I added all the lib files located in the contribution zip to my compile/link bat. Unfortunately I still have unresolved externals. I suspect it is due to not having the xhbzipdll.lib file.

Error: Unresolved external '_deflateEnd' referenced from D:\HARBOUR\LIB\HBZIP.LIB|ziparchive

Vytas
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Vytas wrote:Hi Richard,

The link you provided to me is where I found the hbzip.lib file however the xhbzipdll.lib is not in the zip file.

Thinking that they renamed it I added all the lib files located in the contribution zip to my compile/link bat. Unfortunately I still have unresolved externals. I suspect it is due to not having the xhbzipdll.lib file.

Error: Unresolved external '_deflateEnd' referenced from D:\HARBOUR\LIB\HBZIP.LIB|ziparchive

Vytas
Sorry Vytas, i do not use xharbour.org, i use xharbour.com and xcc compiler. It has been a while since i used bcc compiler, i can not help you further. I am sure someone else will help you get the missing files or a more appropriate link to download them. If not, then please post a message on xharbour.org news.

Richard
Post Reply