🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lua building... problems w/ debug lib

Started by
3 comments, last by eldee 20 years, 2 months ago
Here''s the problem: i''m building Lua in release mode as a static lib, then i try to use it in my project but i cant compile *that* project in debug mode.. i''m aware that i''ll need both debug *and* release libs.. how do big apis like GL and DX get away with only using one lib for both? i''m getting errors out the wazoo about conflicting libraries here... (and just because i know people are going to ask for it, here are the errors

Linking...
libcd.lib(chkesp.obj) : error LNK2005: __CRT_RTC_INIT already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(strcat.obj) : error LNK2005: _strcpy already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(dbgheap.obj) : error LNK2005: _malloc already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
libcd.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
libcd.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
libcd.lib(_ctype.obj) : error LNK2005: _isdigit already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(strftime.obj) : error LNK2005: _strftime already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR70.dll)
libcd.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR70.dll)
LINK : warning LNK4098: defaultlib ''MSVCRT'' conflicts with use of other libs; use /NODEFAULTLIB:library
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib ''libcd.lib'' conflicts with use of other libs; use /NODEFAULTLIB:library
luac_d.lib(print.obj) : error LNK2001: unresolved external symbol _luaP_opnames
 
-eldee ;another space monkey; [ Forced Evolution Studios ]

::evolve:: Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

-eldee;another space monkey;[ Forced Evolution Studios ]
Advertisement
you will need 2 different libs (one for release and one for debug)

to get rid of those error messages you need to set the linker options (link with static lib, static debug lib, dll, mt dll,...) to exactly the same

also from the linker output you can see which libs are conflicting:
libcd.lib: is the standard debug lib (most likely from your app)
MSVCRT.lib: is the multithreaded dll without debug (the lua lib)

(just guessing at the moment, i dont have a vc version available at the moment)


as for how things like ogl or dx do it: (guessing)
as they are just interfaces to the hardware, they will most likely not need any stuff from the standard c library --> no conflicts from there as they wont even linkt to them for building the lib.


mfg Phreak
--
"Input... need input!" - Johnny Five, Short Circuit.
http://mitglied.lycos.de/lousyphreak/
quote: Original post by LousyPhreak
also from the linker output you can see which libs are conflicting:
libcd.lib: is the standard debug lib (most likely from your app)
MSVCRT.lib: is the multithreaded dll without debug (the lua lib)


how would i go about resolving this conflict? just /NODEFAULTLIB it out in the linker options? would that have any detrimental effects further down the road? i figure they included it for a reason, and i dont know enough about what each lib is for to drop the axe

-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

-eldee;another space monkey;[ Forced Evolution Studios ]
either set the linker settings of your lua lib to those of you project, or those of your project to those of the lib (the former is recommended)

i dont know the name of the setting right now (not sitting on my pc right now) but i could look into it if you dont get it


[edit]
actually its in
project->settings->c/c++->code generation->runtime library
(hope its correct for the english version cos i just got the german one )
[/edit]

mfg Phreak
--
"Input... need input!" - Johnny Five, Short Circuit.

[edited by - LousyPhreak on June 17, 2003 6:10:28 AM]
http://mitglied.lycos.de/lousyphreak/
Also, when compiling lua under Windows and not using the Makefile, don''t forget to define LUA_NAMES (in project settings or command line) when compiling liblua, otherwise you will get the _luaP_Opnames error (on the last line of your output).

This topic is closed to new replies.

Advertisement