Can someone help me build D2X-XL from source?

D2X-XL - Descent II update for modern systems with many new features and enhanced graphics. Home Page

Moderators: Grendel, Aus-RED-5

Post Reply
The_cranky_hermit
DBB Cadet
DBB Cadet
Posts: 4
Joined: Thu Aug 03, 2006 6:20 pm

Can someone help me build D2X-XL from source?

Post by The_cranky_hermit »

I'm trying to build D2X-XL in Visual C++ 7. I have four goals, to build the projects d2x and d2xgl, using both the Debug and Release configs. In each goal, I'm having a problem.

d2xgl, Debug
Everything compiles. But when it links, I get this error:

Code: Select all

MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
I've also noticed that if I define the entry point as a function that exists in inferno.c, such as MainLoop, it will finish linking, but the *correct* entry point function seems to be

Code: Select all

int _CDECL_ main (int argc, char *argv[])
which is also located in inferno.c. But I have no idea what I need to type in as the entry point to use this.
My linker command line parameters look like this:

Code: Select all

/OUT:\"d:\\games\\descent\\d2\\d2x-xl-dbg.exe\" /INCREMENTAL /NOLOGO /LIBPATH:\"D:\\visualstudionet\\Vc7\\PlatformSDK\\Lib\" /LIBPATH:\"D:\\cppproj\\SDL-1.2.10\\VisualC\\SDL\\Debug\" /LIBPATH:\"D:\\cppproj\\SDL_mixer-1.2.7\\VisualC\\Debug\" /DEBUG /PDB:\".\\Debug/d2x-xl-dbg.pdb\" /SUBSYSTEM:WINDOWS odbc32.lib odbccp32.lib wsock32.lib opengl32.lib glu32.lib winmm.lib sdl.lib sdl_mixer.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \\cppproj\\d2x\\VisualC\\libmve\\Debug\\libmve.lib \"\\cppproj\\SDL-1.2.10\\VisualC\\SDL\\Debug\\SDL.lib\" \"\\cppproj\\SDL_mixer-1.2.7\\VisualC\\Debug\\SDL_mixer.lib\" /MACHINE:I386

d2xgl, Release
Everything compiles, I get these linking errors:

Code: Select all

MSVCRT.lib(MSVCR70.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _fopen already defined in LIBCMT.lib(fopen.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _strstr already defined in LIBCMT.lib(strstr.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _strncpy already defined in LIBCMT.lib(strncpy.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _atoi already defined in LIBCMT.lib(atox.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _atof already defined in LIBCMT.lib(atof.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _strchr already defined in LIBCMT.lib(strchr.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
MSVCRT.lib(MSVCR70.dll) : error LNK2005: _vsprintf already defined in LIBCMT.lib(vsprintf.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
My linker command line parameters look like this:

Code: Select all

/OUT:\"d:\\games\\descent\\d2\\d2x-xl.exe\" /INCREMENTAL:NO /NOLOGO /LIBPATH:\"D:\\visualstudionet\\Vc7\\PlatformSDK\\Lib\" /LIBPATH:\"D:\\cppproj\\SDL_mixer-1.2.7\\VisualC\\Release\" /PDB:\".\\Release/d2x-xl.pdb\" /SUBSYSTEM:WINDOWS odbc32.lib odbccp32.lib wsock32.lib opengl32.lib glu32.lib winmm.lib sdl.lib sdl_mixer.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \\cppproj\\d2x\\VisualC\\libmve\\Release\\libmve.lib \"\\cppproj\\SDL-1.2.10\\lib\\SDL.lib\" \"\\cppproj\\SDL_mixer-1.2.7\\VisualC\\Release\\SDL_mixer.lib\" /MACHINE:I386

d2x, Debug
I get a *ton* of compile errors. The first few look like this:

Code: Select all

d:\\cppproj\\d2x\\texmap\\tmapflat.c(98) : error C2065: 'gameStates' : undeclared identifier
d:\\cppproj\\d2x\\texmap\\tmapflat.c(98) : error C2224: left of '.render' must have struct/union type
d:\\cppproj\\d2x\\texmap\\tmapflat.c(101) : error C2224: left of '.render' must have struct/union type
d:\\cppproj\\d2x\\texmap\\tmapflat.c(304) : error C2440: 'function' : cannot convert from 'grs_color' to 'int'
d:\\cppproj\\d2x\\texmap\\tmapflat.c(304) : warning C4024: 'texture_map_flat' : different types for formal and actual parameter 2
scanline.c
My compiler command line parameters look like this:

Code: Select all

/Od /I \"..\\..\\include\" /I \"..\\..\\main\" /I \"..\\..\\arch\\include\" /I \"..\\..\\arch\\win32\\include\" /I \"..\\..\\3d\" /I \"..\\..\\..\\..\\sdl\\SDL-1.2.10\\include\" /D \"_DEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"NO_ASM\" /D \"NMONO\" /D \"PIGGY_USE_PAGING\" /D \"NEWDEMO\" /D \"SDL_INPUT\" /D \"SDL_VIDEO\" /D \"FAST_FILE_IO\" /D \"CONSOLE\" /D \"NETWORK\" /D \"NATIVE_IPX\" /D \"_MBCS\" /FD /EHsc /RTC1 /MDd /Fp\".\\Debug/d2x.pch\" /Fo\".\\Debug/\" /Fd\".\\Debug/\" /W3 /nologo /c /ZI

d2x, Release
I *think* the compile errors I get are the same as the ones I get in the Debug config.
My compiler command line parameters look like this:

Code: Select all

/O2 /Ob1 /I \"..\\..\\include\" /I \"..\\..\\main\" /I \"..\\..\\arch\\include\" /I \"..\\..\\arch\\win32\\include\" /I \"..\\..\\3d\" /I \"..\\..\\..\\..\\sdl\\SDL-1.2.10\\include\" /D \"NDEBUG\" /D \"RELEASE\" /D \"WIN32\" /D \"_WINDOWS\" /D \"NO_ASM\" /D \"NMONO\" /D \"PIGGY_USE_PAGING\" /D \"NEWDEMO\" /D \"SDL_INPUT\" /D \"SDL_VIDEO\" /D \"FAST_FILE_IO\" /D \"CONSOLE\" /D \"NETWORK\" /D \"NATIVE_IPX\" /D \"_MBCS\" /GF /FD /EHsc /MD /Gy /YX\"stdafx.h\" /Fp\".\\Release/d2x.pch\" /Fo\".\\Release/\" /Fd\".\\Release/\" /W3 /nologo /c
Thanks in advance for help in solving any of these problems.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

There's no WinMain in any of the sources?
The_cranky_hermit
DBB Cadet
DBB Cadet
Posts: 4
Joined: Thu Aug 03, 2006 6:20 pm

Post by The_cranky_hermit »

I've done a findstr /S /I /C:\"winmain\" *.c on the directory, and found nothing.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Tell you what, I'm gonna move this to the D2X-XL forum, Diedel will more likely see it there.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

You need to also grab and use the SDL and SDL_mixer source from my Descent site. Their source zips contain other zips which in turn contain working MSVC 6 and .NET 2003 projects (at least I hope they work now).

You cannot compile D2X-XL with the standard SDL source because I have applied _cdecl to a few global function declarations to allow for compiling the rest with register calling convention enabled.

The project files also contain all required global defines.
The_cranky_hermit
DBB Cadet
DBB Cadet
Posts: 4
Joined: Thu Aug 03, 2006 6:20 pm

Post by The_cranky_hermit »

I've done that already. I didn't have any trouble building either of those. My \"Solution\" contains 11 projects:

d2x
d2xgl
libmve
mikmod
native_midi
playmus
playwave
SDL
SDL_mixer
SDLmain
timidity

All but d2x and d2xgl will build.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

What is MSVC 7? Is that .NET 2003 or 2005? The proper .NET project is D2X-W32.
The_cranky_hermit
DBB Cadet
DBB Cadet
Posts: 4
Joined: Thu Aug 03, 2006 6:20 pm

Post by The_cranky_hermit »

>>What is MSVC 7? Is that .NET 2003 or 2005?
2003. I *think* that 2005 is VC8.

>>The proper .NET project is D2X-W32
I don't see any project file called that, just an icon file. There's also a folder called d2x-w32, but there aren't any files in it, just a bunch of empty folders. I've redownloaded the source to double-check. I was using d2x.dsw (VC6), which was converted into d2x.sln (VC7).

Update:
As of version 1.6.131, Debug now builds. But trying to build Release gives me this error:

Code: Select all

d:\\cppproj\\d2x\\arch\\sdl\\digi.c(548) : fatal error C1001: INTERNAL COMPILER ERROR  (compiler file 'f:\\vs70builds\\9466\\vc\\Compiler\\Utc\\src\\P2\\main.c', line 146)
I have no idea what this error means or where the directory \"f:\\vs70builds\\9466\\vc\\Compiler\\Utc\\src\\P2\" comes from. I do have a hard drive with the drive letter F, but there is no folder in it called \"vs70builds.\"
Post Reply