Click here to Skip to main content
15,902,894 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: app for windows 8.1 Pin
Richard MacCutchan11-Dec-13 0:23
mveRichard MacCutchan11-Dec-13 0:23 
AnswerRe: app for windows 8.1 Pin
Erudite_Eric11-Dec-13 1:57
Erudite_Eric11-Dec-13 1:57 
QuestionGet rid of STL warnings Pin
_Flaviu10-Dec-13 21:58
_Flaviu10-Dec-13 21:58 
SuggestionRe: Get rid of STL warnings Pin
Richard MacCutchan10-Dec-13 22:23
mveRichard MacCutchan10-Dec-13 22:23 
AnswerRe: Get rid of STL warnings Pin
Freak3010-Dec-13 23:01
Freak3010-Dec-13 23:01 
GeneralRe: Get rid of STL warnings Pin
_Flaviu11-Dec-13 2:37
_Flaviu11-Dec-13 2:37 
SuggestionRe: Get rid of STL warnings Pin
David Crow11-Dec-13 5:19
David Crow11-Dec-13 5:19 
QuestionTrying to reuse code with a static library Pin
Richard Andrew x648-Dec-13 19:21
professionalRichard Andrew x648-Dec-13 19:21 
I'm trying to put reusable code into a static library and link it into a couple of different projects.

The problem is that while linking one of the projects that's supposed to use the reusable code, it reports all sorts of multiply defined symbols. (See below)

The main projects use DLL versions of the C-runtime, and the static library is set to use the multi-threaded dll version also.

What's the trick to successfully linking a static library into multiple projects?
(If I haven't provided enough info, just ask.)

Multiply defined symbols messages:
(Is this happening because the C-runtime is linked into the static lib first, and then those symbols are conflicting with the symbols in the main project?)
5>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __calloc_dbg already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(wsetloca.obj) : error LNK2005: __configthreadlocale already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(swprintf.obj) : error LNK2005: _swprintf_s already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(winapisupp.obj) : error LNK2005: ___crtGetShowWindowMode already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(winapisupp.obj) : error LNK2005: ___crtSetUnhandledExceptionFilter already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(winapisupp.obj) : error LNK2005: ___crtTerminateProcess already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(winapisupp.obj) : error LNK2005: ___crtUnhandledException already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(vsnprnc.obj) : error LNK2005: __vsnprintf_s already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
5>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
5>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
5>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
5>LIBCMTD.lib(vswprnc.obj) : error LNK2005: __vsnwprintf_s already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in msvcrtd.lib(MSVCR120D.dll)
5>LIBCMTD.lib(towlower.obj) : error LNK2005: _towlower already defined in msvcrtd.lib(MSVCR120D.dll)
5>LINK : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
5>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library




The difficult we do right away...
...the impossible takes slightly longer.

AnswerRe: Trying to reuse code with a static library Pin
Richard MacCutchan8-Dec-13 22:24
mveRichard MacCutchan8-Dec-13 22:24 
AnswerRe: Trying to reuse code with a static library Pin
Albert Holguin9-Dec-13 5:23
professionalAlbert Holguin9-Dec-13 5:23 
GeneralRe: Trying to reuse code with a static library Pin
Richard Andrew x649-Dec-13 6:35
professionalRichard Andrew x649-Dec-13 6:35 
GeneralRe: Trying to reuse code with a static library Pin
Albert Holguin9-Dec-13 6:43
professionalAlbert Holguin9-Dec-13 6:43 
AnswerRe: Trying to reuse code with a static library Pin
Gisle Vanem9-Dec-13 22:59
Gisle Vanem9-Dec-13 22:59 
QuestionMissing Button Click Message Pin
BarryPearlman8-Dec-13 8:50
BarryPearlman8-Dec-13 8:50 
QuestionRe: Missing Button Click Message Pin
Richard MacCutchan8-Dec-13 22:21
mveRichard MacCutchan8-Dec-13 22:21 
AnswerRe: Missing Button Click Message Pin
BarryPearlman9-Dec-13 3:45
BarryPearlman9-Dec-13 3:45 
GeneralRe: Missing Button Click Message Pin
Richard MacCutchan9-Dec-13 3:54
mveRichard MacCutchan9-Dec-13 3:54 
GeneralRe: Missing Button Click Message Pin
BarryPearlman9-Dec-13 4:08
BarryPearlman9-Dec-13 4:08 
GeneralRe: Missing Button Click Message Pin
Richard MacCutchan9-Dec-13 5:12
mveRichard MacCutchan9-Dec-13 5:12 
GeneralRe: Missing Button Click Message Pin
BarryPearlman9-Dec-13 9:27
BarryPearlman9-Dec-13 9:27 
AnswerRe: Missing Button Click Message Pin
Freak309-Dec-13 1:18
Freak309-Dec-13 1:18 
GeneralRe: Missing Button Click Message Pin
BarryPearlman9-Dec-13 4:02
BarryPearlman9-Dec-13 4:02 
GeneralRe: Missing Button Click Message Pin
Freak3010-Dec-13 22:51
Freak3010-Dec-13 22:51 
QuestionMorse code in Cpp Pin
Dhananjay RajeNimbalkar6-Dec-13 23:16
Dhananjay RajeNimbalkar6-Dec-13 23:16 
QuestionRe: Morse code in Cpp Pin
Richard MacCutchan7-Dec-13 1:18
mveRichard MacCutchan7-Dec-13 1:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.