Page 1 of 2

Fivewin for xHarbour ( MSVC ) Compile or Link Error!

Posted: Fri Jun 13, 2008 5:04 am
by oknbs
Dear All!

MSVC ( Visual Studio 6.0 ) Compile or Link Error

< Buidxm.bat >

@ECHO OFF
CLS
ECHO FiveWin for xHarbour 8.05 (MSVC++) May. 2008 xHarbour development power
ECHO (c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista

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

ECHO Compiling...

set hdir=D:\Ftdn\xharbourm
set vcdir=D:\VC98
set include=%vcdir%\include;%hdir%\include;%include%
set lib=%vcdir%\lib;%hdir%\lib;%lib%

%hdir%\bin\harbour %1 /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log
@type clip.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

%vcdir%\bin\cl -TP -W3 -c /GA %1.c
:ENDCOMPILE


echo %1.obj > msvc.tmp

echo ..\lib\Fivehmx.lib ..\lib\FiveHCM.lib >> msvc.tmp

echo %hdir%\lib\rtl.lib >> msvc.tmp
echo %hdir%\lib\vm.lib >> msvc.tmp
echo %hdir%\lib\gtgui.lib >> msvc.tmp
echo %hdir%\lib\lang.lib >> msvc.tmp
echo %hdir%\lib\macro.lib >> msvc.tmp
echo %hdir%\lib\rdd.lib >> msvc.tmp
echo %hdir%\lib\dbfntx.lib >> msvc.tmp
echo %hdir%\lib\dbfcdx.lib >> msvc.tmp
echo %hdir%\lib\dbffpt.lib >> msvc.tmp
echo %hdir%\lib\hbsix.lib >> msvc.tmp
echo %hdir%\lib\debug.lib >> msvc.tmp
echo %hdir%\lib\common.lib >> msvc.tmp
echo %hdir%\lib\pp.lib >> msvc.tmp
echo %hdir%\lib\pcrepos.lib >> msvc.tmp

echo %vcdir%\lib\kernel32.lib >> msvc.tmp
echo %vcdir%\lib\user32.lib >> msvc.tmp
echo %vcdir%\lib\gdi32.lib >> msvc.tmp
echo %vcdir%\lib\winspool.lib >> msvc.tmp
echo %vcdir%\lib\comctl32.lib >> msvc.tmp
echo %vcdir%\lib\comdlg32.lib >> msvc.tmp
echo %vcdir%\lib\advapi32.lib >> msvc.tmp
echo %vcdir%\lib\shell32.lib >> msvc.tmp
echo %vcdir%\lib\ole32.lib >> msvc.tmp
echo %vcdir%\lib\oleaut32.lib >> msvc.tmp
echo %vcdir%\lib\uuid.lib >> msvc.tmp
echo %vcdir%\lib\odbc32.lib >> msvc.tmp
echo %vcdir%\lib\odbccp32.lib >> msvc.tmp
echo %vcdir%\lib\mpr.lib >> msvc.tmp
echo %vcdir%\lib\msvcrt.lib >> msvc.tmp


%vcdir%\bin\link @msvc.tmp /NODEFAULTLIB:LIBC /nologo /subsystem:windows /force:multiple



< Tutor01.prg > Compile and Linker

tutor01.c
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
Creating library tutor01.lib and object tutor01.exp
Fivehmx.lib(DLGFIND.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(RADIO.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(PEN.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(INI.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MGET.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TACCTBL.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MENUITEM.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MENU.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TCLIPGET.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(BAR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TOOLBAR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(REBAR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TIMAGLST.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(COMBOBOX.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TMETAFIL.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(STATUSBA.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(BTNBMP.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(RPREVIEW.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MDICLIEN.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TGET.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(RADMENU.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(DDE.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(CURSOR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MDIFRAME.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(CLIPBRD.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(RECT.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(BITMAP.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(PRINTER.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(BRUSH.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(ICON.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TIMER.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(FONT.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TMSGITEM.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(CONTROL.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(TStruct.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MDICHILD.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(SCRLLBAR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(SAY.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(DIALOG.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(MSGBAR.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(WINDOW.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(ACTIVEX.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(REG32.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(BUTTON.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
Fivehmx.lib(listbox.obj) : error LNK2001: unresolved external symbol _HB_FUN___CLSACTIVE
FiveHCM.lib(BRUSHES.obj) : error LNK2001: unresolved external symbol __imp__AlphaBlend@44
rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE
tutor01.exe : fatal error LNK1120: 3 unresolved externals
* There are errors

Posted: Fri Jun 13, 2008 8:24 am
by Antonio Linares
Are you compiling your PRGs using xHB commercial ?

If yes, then you need a more recent build (or beta).

Posted: Fri Jun 13, 2008 8:50 am
by oknbs
Dear Antonio

My Tools => xHarbourm + FWH 8.05 + MSVC++( Visual Studio 6.0 )

FTDN User Downloding Files. ( xHarbourm, FWH 8.05 )

Testing Files /fwh/samples/buildxm.bat tutor01.prg

oknbs

Posted: Fri Jun 13, 2008 9:43 am
by Antonio Linares
Oknbs,

It looks as we have not properly updated xHarbourM.

We are working to provide you a new build asap.

Posted: Fri Jun 13, 2008 11:56 am
by Antonio Linares
Oknbs,

Please try this xHarbour for Microsoft build, thanks:
http://rapidshare.com/files/122138902/x ... m.exe.html

Posted: Fri Jun 13, 2008 3:09 pm
by oknbs
Thank you for answer, Antonio

I compiled your new xharbour file but It has errors below.

?FiveWin for xHarbour 8.05 (MSVC++) May. 2008 xHarbour development power
?(c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista
Compiling...
xHarbour Compiler build 1.1.0 (SimpLex) (Rev. 6138)
Copyright 1999-2008, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'tutor01.prg' and generating preprocessed output to 'tutor01.ppo'...
Generating C source output to 'tutor01.c'...
Done.
tutor01.c
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
Creating library tutor01.lib and object tutor01.exp
FiveHCM.lib(BRUSHES.obj) : error LNK2001: unresolved external symbol __imp__AlphaBlend@44
rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE
tutor01.exe : fatal error LNK1120: 2 unresolved externals
* There are errors

oknbs.

Posted: Fri Jun 13, 2008 6:33 pm
by oknbs
Dear Antonio.


Is above the reason which is encountered errors using vc98( Visual Studio 6 )?
Do I have to use vc2005 in your new xharbourm?

oknbs.

Posted: Fri Jun 13, 2008 9:36 pm
by Antonio Linares
Oknbs,

We keep using VC98 here, for now

You have to link MS msimg32.lib for AlphaBlend unresolved external

We are going to investigate for __HUGE symbol

Posted: Fri Jun 13, 2008 11:00 pm
by Antonio Linares
Oknbs,

Please add this code to your main PRG: (Please note that this solution is for MS VC98 users)

Code: Select all

#pragma BEGINDUMP

double _HUGE = (1.0/0.0);  // infinity

#pragma ENDDUMP
This is a working sample: (can be tested with Borland too)

Code: Select all

function Main()

   MsgInfo( Infinity() )

return nil

#pragma BEGINDUMP

#include <hbapi.h>

double _HUGE = (1.0/0.0);

HB_FUNC( INFINITY )
{
   hb_retndlen( _HUGE, -1, -1 );
}

#pragma ENDDUMP

Posted: Sat Jun 14, 2008 5:35 am
by oknbs
Thank you for answer, Antonio

code => double __HUGE = (1.0/0.0);

error => divide or mod by zero

1/0 ?

< working sample compile result >

FiveWin for xHarbour 8.05 (MSVC++) May. 2008 xHarbour development power
(c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista
Compiling...
xHarbour Compiler build 1.1.0 (SimpLex) (Rev. 6138)
Copyright 1999-2008, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'sample.prg' and generating preprocessed output to 'sample.ppo'...

Lines 20, Functions/Procedures 1
Generating C source output to 'sample.c'...
Done.
sample.c
sample.prg(11) : error C2124: divide or mod by zero
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
Creating library sample.lib and object sample.exp
rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE
sample.exe : fatal error LNK1120: 1 unresolved externals
* There are errors

oknbs.

Posted: Sat Jun 14, 2008 7:17 am
by Antonio Linares
Oknbs,

Just as a workaround use this:

Code: Select all

#pragma BEGINDUMP 

double _HUGE = 0; 

#pragma ENDDUMP

Posted: Sat Jun 14, 2008 8:37 am
by oknbs
Thank you for answer, Antonio

My Samples SourceCode

Code: Select all

function Main()

   MsgInfo( "A" )

return nil


#pragma BEGINDUMP

double __HUGE = 0;

#pragma ENDDUMP

< Batch File >

Code: Select all

@ECHO OFF
CLS
ECHO FiveWin for xHarbour 8.05 (MSVC++) May. 2008    xHarbour development power
ECHO (c) FiveTech, 1993-2008    for Microsoft Windows 95/98/NT/2000/ME/XP/Vista

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

ECHO Compiling...

set hdir=d:\ftdn\xharbourm
set vcdir=d:\VC98
set include=%vcdir%\include;%hdir%\include;%include%
set lib=%vcdir%\lib;%hdir%\lib;%lib%

%hdir%\bin\harbour %1 /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log
@type clip.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

%vcdir%\bin\cl -TP -W3 -c /GA %1.c
:ENDCOMPILE

IF EXIST %1.rc rc -r -d__FLAT__ %1

echo %1.obj  > msvc.tmp

echo ..\lib\Fivehmx.lib ..\lib\FiveHCM.lib  >> msvc.tmp

echo %hdir%\lib\rtl.lib  >> msvc.tmp
echo %hdir%\lib\vm.lib  >> msvc.tmp
echo %hdir%\lib\gtgui.lib  >> msvc.tmp
echo %hdir%\lib\lang.lib  >> msvc.tmp
echo %hdir%\lib\macro.lib  >> msvc.tmp
echo %hdir%\lib\rdd.lib  >> msvc.tmp
echo %hdir%\lib\dbfntx.lib  >> msvc.tmp
echo %hdir%\lib\dbfcdx.lib  >> msvc.tmp
echo %hdir%\lib\dbffpt.lib  >> msvc.tmp
echo %hdir%\lib\hbsix.lib  >> msvc.tmp
echo %hdir%\lib\debug.lib  >> msvc.tmp
echo %hdir%\lib\common.lib  >> msvc.tmp
echo %hdir%\lib\pp.lib  >> msvc.tmp
echo %hdir%\lib\pcrepos.lib  >> msvc.tmp

rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib >> msvc.tmp
rem echo %hdir%\lib\coff\ace32.lib >> msvc.tmp

echo %vcdir%\lib\kernel32.lib  >> msvc.tmp
echo %vcdir%\lib\user32.lib    >> msvc.tmp
echo %vcdir%\lib\gdi32.lib     >> msvc.tmp
echo %vcdir%\lib\winspool.lib  >> msvc.tmp
echo %vcdir%\lib\comctl32.lib  >> msvc.tmp
echo %vcdir%\lib\comdlg32.lib  >> msvc.tmp
echo %vcdir%\lib\advapi32.lib  >> msvc.tmp
echo %vcdir%\lib\shell32.lib   >> msvc.tmp
echo %vcdir%\lib\ole32.lib     >> msvc.tmp
echo %vcdir%\lib\oleaut32.lib  >> msvc.tmp
echo %vcdir%\lib\uuid.lib      >> msvc.tmp
echo %vcdir%\lib\odbc32.lib    >> msvc.tmp
echo %vcdir%\lib\odbccp32.lib  >> msvc.tmp
echo %vcdir%\lib\mpr.lib       >> msvc.tmp
echo %vcdir%\lib\msvcrt.lib    >> msvc.tmp 
echo %vcdir%\lib\msimg32.lib   >> msvc.tmp 

IF EXIST %1.res echo %1.res >> msvc.tmp

%vcdir%\bin\link @msvc.tmp /NODEFAULTLIB:LIBC /nologo /subsystem:windows /force:multiple

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built
%1
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c
@del msvc.tmp

:LINKERROR
ECHO * There are errors
GOTO EXIT

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

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT
< Compile Result >
FiveWin for xHarbour 8.05 (MSVC++) May. 2008 xHarbour development power
(c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista
Compiling...
xHarbour Compiler build 1.1.0 (SimpLex) (Rev. 6138)
Copyright 1999-2008, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'tutor01.prg' and generating preprocessed output to 'tutor01.ppo'...

Lines 14, Functions/Procedures 1
Generating C source output to 'tutor01.c'...
Done.
tutor01.c
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
rtl.lib(math.obj) : warning LNK4006: __matherr already defined in msvcrt.lib(merr.obj); second definition ignored
Creating library tutor01.lib and object tutor01.exp
rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE
tutor01.exe : fatal error LNK1120: 1 unresolved externals
* There are errors

oknbs.

Posted: Sat Jun 14, 2008 8:47 am
by Antonio Linares
Oknbs,

Use only one underscore "_":

double _HUGE = 0;

not __HUGE

The compiler adds the second one :-)

Posted: Sat Jun 14, 2008 3:41 pm
by oknbs
Thank you for answer, Antonio

I used source code below.

double __HUGE = 0;
double _HUGE = 0;

But both of them encountered same error below.

rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE

oknbs.

Posted: Sat Jun 14, 2008 7:24 pm
by Antonio Linares
Oknbs,

It seems as there is a better solution:

Please link VC98 LIBC.lib too