VOGONS

Common searches


First post, by anthony

User metadata
Rank Member
Rank
Member

I'm trying to compile program from old 3dfx sources. Using watcom c 10.6 as recommended in annotation. Obj files from c are done ok, but encounter a lot of undefined symbol errors from linker. May be someone can point me to right solution, how to correctly make an exe?

Reply 2 of 23, by anthony

User metadata
Rank Member
Rank
Member

thanks, i'll doublechek it. but if lnk file is created succesfully isn't it means that libs are linked? here is content of lnk file:

NAME mdc
DEBUG all
LIBPath .\vgatst\lib
LIBPath ..\3dfx\lib
LIBPath ..\lua\lib
LIBPath .\gplay
FILE main.obj
FILE errrpt.obj
FILE pcibrd.obj
FILE banshee.obj
FILE init.obj
FILE mdclua.obj
FILE misc.obj
FILE memerr.obj
FILE memtst.obj
FILE pcitst.obj
FILE builtin.obj
FILE version.obj
FILE crc.obj
FILE lm_bios.obj
FILE lm_ban.obj
FILE lm_glde.obj
FILE vgacore.obj
library fxpci.lib
library llua.lib
library luaaux.lib
library h3cinit.lib
library minihwc.lib
library glide2x.lib
library fxmisc.lib
library vgacore.lib
library ediag.lib
library ediag1.lib
library vgadata.lib
library elib.lib
library repdev.lib
library gplay.lib

Reply 3 of 23, by mrau

User metadata
Rank Oldbie
Rank
Oldbie
anthony wrote:

if lnk file is created succesfully isn't it means that libs are linked?

i don't know watcom, but my experience with other tools tells me that it is only the linker who says if all symbols are there or not; and being there does not mean being in the right folder, you usually have to inform the linker of the binaries to be linked;

Reply 4 of 23, by anthony

User metadata
Rank Member
Rank
Member

quite strange behaviour of linker. he throws an error "undefined symbol" in obj file on function that existed in lib file. i'm looking in filemon access to this lib, it's accessed and readed successfully. if i renaming this lib file, he throws this error anyway and filemon show that this lib is not found. looks like linker can't find function name in lib, but why? function is there

Reply 5 of 23, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

watcom has two kinds of libraries, register based libs and stack based (for calling convention). cant help without knowing the real error your getting. my guess is your tring to link against the wrong kinds of libraries. but, again, you need to paste the real output from wlink or wcl.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 6 of 23, by anthony

User metadata
Rank Member
Rank
Member

here is wlink message:

Warning(1028): pciGetVendorName is an undefined reference
Warning(1028): h3InitPlls is an undefined reference
Warning(1028): _grSplashCb@24 is an undefined reference
Warning(1028): guColorCombineFunction is an undefined reference
Warning(1028): _printf is an undefined reference
Warning(1028): _sprintf is an undefined reference
Warning(1028): _malloc is an undefined reference
Warning(1028): _free is an undefined reference
Warning(1028): __imp__GetVersionExA@4 is an undefined reference
Warning(1028): __imp__CreateFileA@28 is an undefined reference
Warning(1028): __imp__CloseHandle@4 is an undefined reference
Warning(1028): _getenv is an undefined reference
Warning(1028): __imp__DeviceIoControl@32 is an undefined reference
Warning(1028): __imp__OutputDebugStringA@4 is an undefined reference
file pcibrd.obj(D:\3DFX\H5\DIAGS\MFTG\CORE\pcibrd.c): undefined symbol PCI_AGP_C
MD
Error(3137): too many errors encountered
Error(E42): Last command making (mdc.exe) returned a bad status
Error(E02): Make execution terminated

pcibrd.c has #include "fxpci.h"
and fxpci.h has
extern const PciRegister PCI_AGP_CMD;

Reply 7 of 23, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

that _printf is missing says your not linking in the base libraries. is your watcom environment strings setup correctly?

ohh also, your compiling windows source, __imp__GetVersionExA, is a win32 call. I guess I assumed you were doing DOS, but its win32. do you have all the win32 libraries installed and headers etc?

that PCI_AGP_CMD is inside a header but not being seen, its probably IFDEF'd out through another mechanism.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 8 of 23, by Azarien

User metadata
Rank Oldbie
Rank
Oldbie

Can you compile a simple Hello world program that uses printf()?

I'm trying to compile program from old 3dfx sources.

Is it supposed to be DOS or Windows program? Are you building for the right target?
DOS binaries that default to DOS targeting are in BINW directory.

Reply 9 of 23, by anthony

User metadata
Rank Member
Rank
Member

thank you guys for your attention. i'm using all files without changing em. all are original from 3dfx. looks like it's quite complicated programm that uses dos and windows modules.

may be you can take a look at this code mess: http://naviburg.ru/tmp/MFTG.rar
i run it by build.bat or wmake /f wmake.mak in core dir

compiling is not a problem, i think. obj files and lib files are compiled from c successfully. errors are from linker

Reply 10 of 23, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

I took a quick look, I cant build it because I dont have a windows install. It wants to run under nt/98 which none of my systems that have watcom on it are.

but, in the mftg directory run setenv.bat, then run clean.bat then build.bat

looks like you might need NMAKE from MSVC 4.2, as well as some other 3dfx sdk stuff. look in setenv.bat where its looking for headers and such.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 11 of 23, by anthony

User metadata
Rank Member
Rank
Member

i have calling setenv from autoexec. running clean.bat every time is not crucial, i presume, cause it removes obj and lib files, and on next run of build.bat it creates them again without any problems. nmake i have installed

i think openwatcom is able to assemble this exe file, but is has much more strict compiler. i've tryed it, but get too much errors

Reply 12 of 23, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

openwatcom doesnt ship with the win32 headers/libs etc unless something has changed. do you have your watcom environment setup? (LIB + INCLUDE environment vars)?

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 13 of 23, by anthony

User metadata
Rank Member
Rank
Member

here is my setenv

@echo off
REM ------------------------------------------
REM SetEnv.BAT SET UP 3DFX BUILD ENVIRONMENT
REM for Voodoo4 Manufacturing Diags
REM ------------------------------------------

REM ------------------------------------------
REM STORE THE PATH
REM ------------------------------------------
IF NOT "%OLDPATH%"=="" GOTO DONTSTORE
SET OLDPATH=%PATH%
:DONTSTORE


REM ---------------------------------------------------------
REM SET THE FOLLOWING VARIABLES (before attempting to compile
REM ---------------------------------------------------------

REM You must set NMAKE to the directory that contains nmake.exe
REM from MSVC 4.2 (3Dfx always uses nmake for all builds.)
set NMAKE=d:\msvc\bin

REM You must set BUILD_DRIVE to the drive that you are building on ex:
set BUILD_DRIVE=d:

REM You must set BUILD_ROOT to the root of where you extracted your
REM source kit to ex:
set BUILD_ROOT=%BUILD_DRIVE%\3dfx

REM You must set WATCOM to the location of your Watcom compiler files ex:
set WATCOM=d:\watcom


REM ------------------------------------------
REM CHECK CRITICAL VARS
REM ------------------------------------------
IF NOT "%BUILD_DRIVE%"=="" GOTO DRIVEDEFD
ECHO You must set the environment variable BUILD_DRIVE
ECHO to the driver letter of the source tree.
ECHO eg. SET BUILD_DRIVE=d:
GOTO END
:DRIVEDEFD
IF NOT "%BUILD_ROOT%"=="" GOTO ROOTDEFD
ECHO You must set the environment variable BUILD_ROOT
ECHO to the root directory of the source tree.
ECHO eg. SET BUILD_ROOT=\3dfx\devel
ECHO NOTE: BUILD_ROOT doesn't need a drive letter.
GOTO END
:ROOTDEFD
IF NOT "%WATCOM%"=="" GOTO WATDEFD1
ECHO You must set the environment variable WATCOM
ECHO to the install directory for Watcom
ECHO C/C++ 10.6 or greater
ECHO eg. SET WATCOM=C:\devel\WATCOM
GOTO END
:WATDEFD1


REM ------------------------------------------
REM SET COMMON VARS
Show last 25 lines
REM ------------------------------------------
set MASM=d:\masm611
SET BUILD_ROOT_H5=%BUILD_ROOT%\H5
SET BUILD_ROOT_SWLIBS=%BUILD_ROOT%\swlibs

SET PATH=%WATCOM%\bin95;%WATCOM%\binw;%OLDPATH%
SET INCLUDE=%WATCOM%\H;%WATCOM%\H\NT;%INCLUDE%;%BUILD_ROOT%\H5\DIAGS\MFTG\3dfx\include
REM SET INCLUDE=%INCLUDE%;%BUILD_ROOT_SWLIBS%\include\nmake;%MASM%\INCLUDE

SET LIB=%WATCOM%\LIB386\DOS;%MASM%\lib;%INCLUDE%;%BUILD_ROOT%\H5\DIAGS\MFTG\3Dfx\lib

SET FX_WATCOM_REG_CALL=
set FX_GLIDE_HW=H5
set FX_NO_GEN_BOF=1
set GLIDE_INIT_HWC=1
set FX_TARGET=DOS
set FX_GLIDE_PACKET_FIFO=1
set FX_INSTALL_DESTINATION=%STAGE_ROOT%\GLIDE\H5\DOS\DOSS\STATIC\ATRI\REL
set FX_COMPILER=WATCOM
set MKS_PATH=c:\DevTools\mks
REM set PATH=%NMAKE%;%WATCOM%\BIN95;%WATCOM%\BINNT;%WATCOM%\BINW;%MASM%\BIN;%PATH%
REM set INCLUDE=%WATCOM%\H;%WATCOM%\H\NT;%MASM%\INCLUDE;%INCLUDE%;%BUILD_ROOT%\3Dfx\include
REM set LIB=%WATCOM%\LIB386\DOS;%MASM%\LIB;%LIB%;%BUILD_ROOT%\3Dfx\lib

:END

and here is what watcom diag tool detects:

Watcom                          Phone: (519) 884-0702
415 Phillip St. Fax: (519) 747-4971
Waterloo, Ontario
CANADA N2L 3X2

------------------Watcom C Environment Variables ----------------
WATCOM=<d:\watcom>
EDPATH=<d:\watcom\EDDAT>
INCLUDE=<d:\watcom\H;d:\watcom\H\NT;d:\watcom\H;d:\watcom\H\NT;d:\watcom\H\NT\DI
RECTX;d:\watcom\H\NT\DDK;d:\3dfx\H5\DIAGS\MFTG\3dfx\include>
LIB=<d:\watcom\LIB386\DOS;d:\masm611\lib;d:\watcom\H;d:\watcom\H\NT;d:\watcom\H;
d:\watcom\H\NT;d:\watcom\H\NT\DIRECTX;d:\watcom\H\NT\DDK;d:\3dfx\H5\DIAGS\MFTG\3
dfx\include;d:\3dfx\H5\DIAGS\MFTG\3Dfx\lib>
PATH=<D:\WATCOM\BIN95;D:\WATCOM\BINW;C:\WIN_VIA;C:\WIN_VIA\COMMAND;C:\WINDOWS\CO
MMAND;D:\WATCOM\BINNT;D:\WATCOM\BINW;C:\WIN12\COMMAND;C:\ULTRASND;C:\;C:\TBEACH\
DOSAPPS;C:\DOS;C:\DISTRIB;C:\DN;C:\MSVC\BIN>
TMP=<c:\temp>
File 'd:\watcom\binp\ide.exe' has not been patched
File 'd:\watcom\binw\ide.exe' has not been patched
File 'd:\watcom\binnt\ide.exe' has not been patched
File 'd:\watcom\binp\wbrw.exe' has not been patched
File 'd:\watcom\binw\wbrw.exe' has not been patched
File 'd:\watcom\binnt\wbrw.exe' has not been patched
File 'd:\watcom\binp\wd.exe' has not been patched

Reply 15 of 23, by ynari

User metadata
Rank Member
Rank
Member

Which version of the Windows libraries are you using? Ones with Watcom, or a Windows SDK? If the latter, you may need to be careful about the version - old compilers need old SDK versions.

Looks like a library link issue, though, and make sure that all library types match i.e. trying to call a multithreaded library from a non multithreaded program.

Reply 16 of 23, by anthony

User metadata
Rank Member
Rank
Member

libraries are from watcom cd. i'm agree that something strange with libraries. looks like linker don't see em. even warnings on printf

here is recommendations on buid.bat:

To compile you must:
- have watcom 10.4 - 10.6 installed and in your PATH
- be running under windows 95 or windows NT

and it's all

Reply 17 of 23, by anthony

User metadata
Rank Member
Rank
Member

think i found a reason of this behaviour of linker. for example const PCI_AGP_CMD everywhere except lib file is written without underscore, but in lib file it with underscore _PCI_AGP_CMD. same for standart functions like printf. there are lots of this unmatched names of functions and variables. don't know how to normalize it without lots of manual editing

Reply 19 of 23, by anthony

User metadata
Rank Member
Rank
Member

i have to try it rather then keep looking on error messages

need an advice. have fuction calling grSplashCb in c file. in obj file it appears as _grSplashCb@24 and linker shows an error "undefined symbol _grSplashCb@24". in glide.h (https://sourcecodebrowser.com/glide/2002.04.1 … _8h_source.html 01127 line) i see this function declaration as grSplashCb. and no lib file with it. what should i do to avoid this error?