www.digitalmars.com         C & C++   DMDScript  

c++ - Need help linking

reply parabolis <parabolis softhome.net> writes:
I have been trying to compile the most basic of SDL apps but keep 
getting "Symbol Undefined" messages:
----------------------------------------------------------------
D:\dev\c++\sdl_attempt>dmc attempt SDLmain.lib SDL.lib 
-L/ENTRY:_WinMain 16
link attempt,,,SDLmain+SDL+user32+kernel32/noi/ENTRY:_WinMain 16;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

SDLmain.lib(SDL_win32_main)
  Error 42: Symbol Undefined __getcwd
SDLmain.lib(SDL_win32_main)
  Error 42: Symbol Undefined ___mb_cur_max
----------------------------------------------------------------

A quick check of SDLmain.lib shows what it is expecting
----------------------------------------------------------------
D:\dev\c++\sdl_attempt>libunres SDLmain.lib
Unresolved externals:
_SDL_GetError
_SDL_Init
_SDL_Quit
_SDL_SetModuleHandle
_SDL_main
__alloca_probe
__imp__FreeLibrary 4
__imp__GetCommandLineA 0
__imp__GetModuleHandleA 4
__imp__LoadLibraryA 4
__imp____mb_cur_max
__imp___getcwd
__imp___iob
__imp___isctype
__imp___pctype
__imp__exit
__imp__fclose
__imp__fgetc
__imp__fopen
__imp__fprintf
__imp__freopen
__imp__remove
__imp__setbuf
__imp__setvbuf
__imp__strncpy
__imp__strrchr
_atexit
----------------------------------------------------------------

Trying to find the lib that contains these symbols shows:
----------------------------------------------------------------
D:\comp\dm\lib>grep __getcwd *
Binary file sdc.lib matches
Binary file sdl.lib matches
Binary file sdm.lib matches
Binary file sds.lib matches
Binary file sdx.lib matches
----------------------------------------------------------------

Linnking explicity against any of those gives a list of 400+ 
error messages -- the first error in each is "Memory Model 
Conflict." Since there is pretty much a 1:1 correspondence 
between dmc -m? options and sd?.lib files I am assuming each 
corresponds to a library for the memory model. However get_cwd 
and friends need to be implemented somewhere and grep says DMC 
does not do it for me. However grep also says I have no windows 
DLLs to do it either:
----------------------------------------------------------------
D:\comp\dm\lib>grep __getcwd c:\windows\*.dll
   <nothing>
D:\comp\dm\lib>grep __getcwd c:\windows\system\*.dll
   <nothing>
D:\comp\dm\lib>grep __getcwd c:\windows\system32\*.dll
   <nothing>
----------------------------------------------------------------

Any help at all would be greatly appreciated. Thanks in advance 
for taking the time to read this post!
Jan 24 2005
parent "Walter" <newshound digitalmars.com> writes:
"parabolis" <parabolis softhome.net> wrote in message
news:ct3mi0$2cbc$1 digitaldaemon.com...
 ----------------------------------------------------------------

 Trying to find the lib that contains these symbols shows:
 ----------------------------------------------------------------
 D:\comp\dm\lib>grep __getcwd *
 Binary file sdc.lib matches
 Binary file sdl.lib matches
 Binary file sdm.lib matches
 Binary file sds.lib matches
 Binary file sdx.lib matches
 ----------------------------------------------------------------

 Linnking explicity against any of those gives a list of 400+
 error messages -- the first error in each is "Memory Model
 Conflict."
That's because sdc.lib is for 16 bit code, C memory model. sdl.lib is for 16 bit code, L memory model, etc. The Win32 memory model library is snn.lib, which is probably what you're looking for.
Feb 02 2005