Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » DUMB doesn't work in MSVC

This thread is locked; no one can reply to it. rss feed Print
DUMB doesn't work in MSVC
miran
Member #2,407
June 2002

I'm trying to use DUMB in my game. Everything compiles fine but when I link, I get this error:

Quote:

Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBC.lib(malloc.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBC.lib(crt0dat.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _realloc already defined in LIBC.lib(realloc.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Release/dumbtest.exe : fatal error LNK1169: one or more multiply defined symbols found

So I do what the message says: I use /nodefaultlib:LIBC.lib but then I get this:

Quote:

Linking...
playit.obj : error LNK2001: unresolved external symbol _errno
Release/dumbtest.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

What's wrong here? And don't tell me I'm mixing singlethreaded and multithreaded versions of the standard libraries because I have no idea what that means. I just made a new project, added one of the examples that come with DUMB, added "aldmb.lib dumb.lib alleg.lib" to the beginning of the linker options and hit the compile button. And it doesn't work!

EDIT:
Ignore the part about me not knowing what singlethreaded and multithreaded versions of standard libraries are (just did a search). I switched to linking with the multithreaded libraries but now I'm getting this:

Quote:

Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Release/dumbtest.exe : fatal error LNK1169: one or more multiply defined symbols found

And if I use /nodefaultlib:"MSVCRT.lib" I get this:

Quote:

Linking...
LINK : warning LNK4049: locally defined symbol "_free" imported
LINK : warning LNK4049: locally defined symbol "_malloc" imported
LINK : warning LNK4049: locally defined symbol "_exit" imported
LINK : warning LNK4049: locally defined symbol "_realloc" imported
dumb.lib(itrender.obj) : error LNK2001: unresolved external symbol __imp__qsort
dumb.lib(itread.obj) : error LNK2001: unresolved external symbol __imp__qsort
dumb.lib(itread.obj) : error LNK2001: unresolved external symbol __imp__fprintf
dumb.lib(itread.obj) : error LNK2001: unresolved external symbol __imp___iob
Release/dumbtest.exe : fatal error LNK1120: 3 unresolved externals

--
sig used to be here

Bruce Perry
Member #270
April 2000

D'oh! Didn't see this thread until you mentioned it elsewhere ;)

Try linking with /MD. Since DUMB is statically linked, you need to link with the same libc implementation that DUMB uses; /MD selects the multithreaded DLL version. You would also have to use /MD if you were static-linking Allegro.

This will be in the docs (especially the FAQ) for the next release.

[EDIT]
OK, read the post fully now ::)

Quote:

And don't tell me I'm mixing singlethreaded and multithreaded versions of the standard libraries because I have no idea what that means.

Did someone already suggest that theory or something? ???

Anyway, it's the multithreaded DLL library you need. It looks as if you were trying to use the static multithreaded library.

Let us know if it works now :)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

miran
Member #2,407
June 2002

Whoohoo! It works! Thanks a lot!

Anyway, I read in some older threads (this problem seems to come up often) that you're supposed to link with the multithreaded library but noone said anything about DLL vs static and I never thought of trying DLL myself. Thanks again!

Now if I could only write some good music to put in my game...

--
sig used to be here

Bruce Perry
Member #270
April 2000

Indeed - Bob told me about the problem, but I didn't catch the "DLL" part, and it was a while before I fully understood. I went to the computer room (where they have MSVC installed), and, despite dire file space limitations, I managed to reproduce the error myself :)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Go to: