[vorbis] using win32 static libs

Rüpel ruepel at gmx.li
Mon Jun 16 01:26:13 PDT 2003



hi,

i hope this is not too "newbie-ish" but i've never programmed with static libs before.

i've downloaded the win32sdk and try to build a simple wav->ogg/vorbis encoder, but the linker complained about several redefinitions.

environment is visual studio .net 2003 on winxp and a standard mfc-app set up by this project-wizzard that comes with vs.net2003 using the default settings.

here the code:
----------------------------------------------------------------------
#include "StdAfx.h"
#include ".\ogg2wav.h"

#include "oggvorbis\vorbisenc.h"

#pragma comment(lib,"oggvorbis\\ogg_static.lib")
#pragma comment(lib,"oggvorbis\\vorbis_static.lib")
#pragma comment(lib,"oggvorbis\\vorbisenc_static.lib")

void COgg2Wav::Convert(CString strWavPath, CString strOggPath)
{
        vorbis_info      vi;

        vorbis_info_init(&vi);
        // here comes *the* code, when i'm done with the linker-issue ;)
}
----------------------------------------------------------------------
the compiler runs fine but the linker complains:
----------------------------------------------------------------------
OggVorbisTest error LNK2005: __ldused already defined in a previous module
OggVorbisTest error LNK2005: __fltused already defined in a previous module
OggVorbisTest error LNK2005: _exit already defined in msvcrt.lib(MSVCR71.dll)
OggVorbisTest error LNK2005: __exit already defined in msvcrt.lib(MSVCR71.dll)
OggVorbisTest error LNK2005: __cexit already defined in msvcrt.lib(MSVCR71.dll)
OggVorbisTest error LNK2005: __c_exit already defined in msvcrt.lib(MSVCR71.dll)
OggVorbisTest error LNK2005: __XcptFilter already defined in msvcrt.lib(MSVCR71.dll)
OggVorbisTest error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
OggVorbisTest error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
OggVorbisTest error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
OggVorbisTest error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
OggVorbisTest error LNK2005: __setmbcp already defined in libcmt.lib(mbctype.obj)
OggVorbisTest warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
OggVorbisTest warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
OggVorbisTest fatal error LNK1169: one or more multiply defined symbols found
----------------------------------------------------------------------

i've tried the suggested options, and /NODEFAULTLIB:libcmt.lib solves the problem :)

btw: /NODEFAULTLIB:msvcrt.lib was not a good idea, because then some basic symbols (malloc etc) were not defined.

can someone explain that to me? why are the conflicts with msvcrt.lib gone, when i'm excluding libcmt.lib? these too can't be conflicting because they are both default-libs.
libcmt stands for libc m(ulti)t(hreaded)

do the ogg/vorbis-libs require certain linker options to be set/unset? is there anything i need to know when working with the *_static.lib files from the ogg/vorbis-win32sdk?

thx again for your help..+-j·!Š÷¬†Ûiÿü0醊àýªÜ†+Þ:)®ˆÞrØh™êZèm¶ŸÿÃ1Š˜h®èN‹§²æìr¸›yúèšØb²X¬¶Ç§u©ž²Æ zÚ/¢¶â²·ª¹ë-Æ*ar‰íj)âž
'—+a{
+véì¹»®&ÞŠ{ayºÈÚ,¹¸ÞrجçR{.nÇ+‰·¦zˁë,z{m¢Ø^–+-Â)emè žŠÞw÷â–׫



More information about the Vorbis mailing list