Error 1 error LNK2005: _printf already defined in
libcmtd.lib(printf.obj) MSVCRTD.lib
Error 2 error LNK2005: _free already defined in
libcmtd.lib(dbgheap.obj) MSVCRTD.lib
Error 3 error LNK2005: _malloc already defined in
libcmtd.lib(dbgheap.obj) MSVCRTD.lib
Error 4 error LNK2005: "private: __thiscall
type_info::type_info(class
type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in
libcmtd.lib(typinfo.obj) MSVCRTD.lib
Error 5 error LNK2005: "private: class type_info & __thiscall
type_info::operator=3D(class type_info const &)"
(??4type_info@@AAEAAV0@ABV0@@Z) already defined in
libcmtd.lib(typinfo.obj) MSVCRTD.lib
Error 6 error LNK2005: __vswprintf already defined in
libcmtd.lib(vswprint.obj) MSVCRTD.lib
Error 7 error LNK2005: _sprintf already defined in
libcmtd.lib(sprintf.obj) MSVCRTD.lib
Error 8 error LNK2005: _wcschr already defined in
libcmtd.lib(wcschr.obj) MSVCRTD.lib
Error 10 fatal error LNK1169: one or more multiply defined
symbols
found
d:\wf\integration\test4\InitialIntegration-Lib\InitialIntegration\CAAgent\D=
=ADebug\DeviceAccessMonitoring.dll
1
Error 12 error LNK2019: unresolved external symbol "public:
__thiscall
CDeviceAccessMonitor::CDeviceAccessMonitor(void)"
(??0CDeviceAccessMonitor@@QAE@XZ) referenced in function "int __cdecl
StartServiceThread(void)" (?StartServiceThread@@YAHXZ)
InitCAApp.obj
Error 13 fatal error LNK1120: 1 unresolved
externals
d:\wf\integration\test4\InitialIntegration-Lib\InitialIntegration\CAAgent\D=
=ADebug\InitCAApp.exe
1

I am creating several projects with static library. When i finally make

an executable using this static libraries. I am getting the above
errors.


What is the basic fundamental of using the static library in right way?

Re: static library by Igor

Igor
Thu Jun 08 14:03:01 CDT 2006

manishpoplii@gmail.com wrote:
> Error 1 error LNK2005: _printf already defined in
> libcmtd.lib(printf.obj) MSVCRTD.lib

Your executable links to CRT statically, but you are using a library
that is built against CRT DLL. Or the other way round. Make sure that
everything in your project is being built against the same CRT flavor.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: static library by manishpoplii

manishpoplii
Thu Jun 08 14:20:21 CDT 2006

Should i check using
Configuration Properties-> c/c++ Code Generation -> Run Time Library. I
have set the values as Multi-threaded Debug DLL (/MDd)

Is there any other way of checking the same.
Regards,
Sunil Virmani



Igor Tandetnik wrote:
> manishpoplii@gmail.com wrote:
> > Error 1 error LNK2005: _printf already defined in
> > libcmtd.lib(printf.obj) MSVCRTD.lib
>
> Your executable links to CRT statically, but you are using a library
> that is built against CRT DLL. Or the other way round. Make sure that
> everything in your project is being built against the same CRT flavor.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925


Re: static library by manishpoplii

manishpoplii
Thu Jun 08 14:24:23 CDT 2006

Thanks for the quick response.

I am novice to VC++ and visual studio. Should i check on Configuration
Properties->C/C++-> Code Generation->RunTime Library.







Igor Tandetnik wrote:
> manishpoplii@gmail.com wrote:
> > Error 1 error LNK2005: _printf already defined in
> > libcmtd.lib(printf.obj) MSVCRTD.lib
>
> Your executable links to CRT statically, but you are using a library
> that is built against CRT DLL. Or the other way round. Make sure that
> everything in your project is being built against the same CRT flavor.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925


Re: static library by Igor

Igor
Thu Jun 08 15:23:35 CDT 2006

manishpoplii@gmail.com wrote:
> Should i check using
> Configuration Properties-> c/c++ Code Generation -> Run Time Library.
> I have set the values as Multi-threaded Debug DLL (/MDd)

Yes, that's where you should check. Make sure that not only your
application project, but also all the static libraries it uses, are
built with the same setting. One of your static libraries is built with
Multi-threaded Debug (/MTd)
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925