multiple definition error

User avatar
Antonio Linares
Site Admin
Posts: 42551
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 79 times
Contact:

Re: multiple definition error

Post by Antonio Linares »

In this section:

[43998.974] C:\Winclip\qtcontrib\comp\mingw\bin\gcc.exe .hbmk/win/mingw/hello.o .hbmk/win/mingw/_hbmkaut_hello.o -mconsole -Wl,--start-group -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainstd -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib c:/winclip/fwh1507/lib/FiveHGC.lib c:/winclip/fwh1507/lib/FiveHG.lib -Wl,--end-group -ohello.exe -LC:/Winclip/qtcontrib/lib/win/mingw


c:/winclip/fwh1507/lib/FiveHGC.lib and c:/winclip/fwh1507/lib/FiveHG.lib should be linked before -lhbextern
I don't know how we can do it using hbmk2

We use this batch file to build Harbour and FWH + MinGW GCC here:

buildg.bat

Code: Select all | Expand

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour 17.01 and GCC - Jan. 2017   Harbour development power  ³Ü
ECHO ³ (c) FiveTech 1993-2017 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

if "%fwh%" == "" set fwh=.\..

set hdir=c:\harbour
set hdirc=%hdir%\bin\harbour.exe
set hlibs=%hdir%\lib\gcc
set mingw=c:\Qt\Tools\mingw491_32
set path=%mingw%\bin

%hdirc% %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
IF ERRORLEVEL 1 GOTO COMPILEERROR
@type comp.log
@type warnings.log

%mingw%\bin\gcc -c %1.c -o%1.o -I%hdir%\include -I%mingw%\include -Wall
IF ERRORLEVEL 1 GOTO COMPILEERROR

if exist %1.rc %mingw%\bin\windres -D__FLAT__ -DDIALOG=DIALOGEX -i%1.rc -o_%1.o
IF ERRORLEVEL 1 GOTO RESOURCESERROR

if not exist %1.rc %mingw%\bin\gcc -o%1.exe %1.o -Wall -s -mwindows -L%mingw%\lib -L%hlibs% -L%fwh%\lib -Wl,--start-group -lfivehg -lfivehgc -lgtgui -luser32 -lwinspool -lkernel32 -lcomctl32 -lcomdlg32 -lgdi32 -lgdiplus -lole32 -loleaut32 -lpsapi -loledlg -lmfcuia32 -lmsimg32 -lwin32k -lstdc++ -lversion -luuid -lwinmm -lvfw32 -lwsock32 -lshell32 -lmpr -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbdebug -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmzip -lodbc32 -lhbpcre -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbwin -lhbzlib -lrddcdx -lrddfpt -lrddntx -lxhb -lhbziparc -lminizip -lhbmzip -lhbziparc -lpng -Wl,--end-group
if exist %1.rc %mingw%\bin\gcc -o%1.exe %1.o _%1.o -Wall -s -mwindows -L%mingw%\lib -L%hlibs% -L%fwh%\lib -Wl,--start-group -lfivehg -lfivehgc -lgtgui -luser32 -lwinspool -lkernel32 -lcomctl32 -lcomdlg32 -lgdi32 -lgdiplus -lole32 -loleaut32 -lpsapi -lmsimg32 -lwin32k -loledlg -lstdc++ -lmfcuia32 -lversion -luuid -lwinmm -lvfw32 -lwsock32 -lshell32 -lmpr -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbdebug -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmzip -lodbc32 -lhbpcre -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbwin -lhbzlib -lrddcdx -lrddfpt -lrddntx -lxhb -lhbziparc -lminizip -lhbmzip -lhbziparc -lpng -Wl,--end-group

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built
%1
rem delete temporary files
@del %1.c
@if exist %1.rc del _%1.o
GOTO EXIT
ECHO

:RESOURCESERROR
ECHO * Resources errors *
GOTO EXIT

:COMPILEERROR
@type comp.log
ECHO * Compile errors *
GOTO EXIT

:LINKERROR
ECHO * Link errors *
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Buildg [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                 {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42551
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 79 times
Contact:

Re: multiple definition error

Post by Antonio Linares »

I have been able to build your example using hbmk2 and FWH 17.01 and MinGW GCC:

hello.hbp

Code: Select all | Expand

# hbmk2 Flags
-trace

# GT Requested
-gtgui
xhb.hbc
hbmzip.hbc
hbziparc.hbc

-ic:\fwh\include

-Lc:\fwh\lib -lFiveHG
-Lc:\fwh\lib -lFiveHGC

-lgdiplus
-lstdc++
-loleaut32
-loledlg
-lole32
-lmsimg32
-lshell32
-lversion

# Compilable Sources
hello.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: multiple definition error

Post by marzio »

many thanks Antonio,

now I will do some test.

Marzio
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: multiple definition error

Post by marzio »

ok Antonio,
with your instructions now i am able to compile the fivewin example file with hbide.
only i have added Others requested libraries.

Code: Select all | Expand


# hbmk2 Flags
-trace

# GT Requested
-gtgui

#-lhbdebug

-ic:\winclip\fwh1610\include
-Lc:\winclip\fwh1610\lib -lFiveHG
-Lc:\winclip\fwh1610\lib -lFiveHGC

-lgdiplus
-lstdc++
-loleaut32
-loledlg
-lole32
-lmsimg32
-lshell32
-lversion

-lhbct
-lodbc32

-lhbwin
-lxhb
-lhbziparc
-lminizip
-lhbmzip

# Compilable Sources
hello.prg
 


i want to try the hbide debug, but, with fivehg.lib and fivehgc.lib before of all Others libraries, Always start the fivewin debug.
if there is not other way, is it possbile temporarily remove debug from the fivewin libraries?
can you post the command to do this?
i have tried with ar.exe but with no success.

thanks, marzio
User avatar
Antonio Linares
Site Admin
Posts: 42551
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 79 times
Contact:

Re: multiple definition error

Post by Antonio Linares »

Marzio,

Please create an empty file named fwdbg.prg, compile it with Harbour and gcc and then do:

$(GDIR)\bin\ar rc FiveHG.lib fwdbg.o
regards, saludos

Antonio Linares
www.fivetechsoft.com
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: multiple definition error

Post by marzio »

many thanks, Antonio
i have followed your instructions and now works hbide debug.
with little example of window fivewin works fine
i will try with a more big prg

marzio
Post Reply