Managed c++ with unmanaged code Linking problem... 
Author Message
 Managed c++ with unmanaged code Linking problem...

I'm sure I'm missing something obvious, but could someone point out my
stupidity?

I had an ATL COM object that wrapped a simple c++/stl member object.  I'd
like to create a managed object that wraps the same unmanaged member.  I
used the wizard to create the managed library, added the files for the
internal class (which is rather complex and includes a  .lib) and the
compilation goes ok, but the linker returns the output below.

Can anyone tell me what I have to do to get past this?

TIA.

Errors:

msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _free already defined in
LIBCMTD.lib(dbgheap.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: ___threadid already defined in
LIBCMTD.lib(tidtable.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _malloc already defined in
LIBCMTD.lib(dbgheap.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _isspace already defined in
LIBCMTD.lib(_ctype.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _strncpy already defined in
LIBCMTD.lib(strncpy.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _calloc already defined in
LIBCMTD.lib(dbgheap.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fclose already defined in
LIBCMTD.lib(fclose.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _realloc already defined in
LIBCMTD.lib(dbgheap.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _memmove already defined in
LIBCMTD.lib(memmove.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fflush already defined in
LIBCMTD.lib(fflush.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fopen already defined in
LIBCMTD.lib(fopen.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _atoi already defined in
LIBCMTD.lib(atox.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _isdigit already defined in
LIBCMTD.lib(_ctype.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _sprintf already defined in
LIBCMTD.lib(sprintf.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _gmtime already defined in
LIBCMTD.lib(gmtime.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _printf already defined in
LIBCMTD.lib(printf.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _exit already defined in
LIBCMTD.lib(crt0dat.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fprintf already defined in
LIBCMTD.lib(fprintf.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __fsopen already defined in
LIBCMTD.lib(fopen.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _strncmp already defined in
LIBCMTD.lib(strncmp.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _vsprintf already defined in
LIBCMTD.lib(vsprintf.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _tolower already defined in
LIBCMTD.lib(tolower.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _qsort already defined in
LIBCMTD.lib(qsort.obj)
msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __stricmp already defined in
LIBCMTD.lib(stricmp.obj)



Wed, 05 Oct 2005 04:20:40 GMT  
 Managed c++ with unmanaged code Linking problem...
You are linking with two different versions of the c
runtime:

msvcrtd.lib
LIBCMTD.lib

Try looking at your Runtime Library options...

Quote:
>-----Original Message-----

>I'm sure I'm missing something obvious, but could

someone point out my
Quote:
>stupidity?

>I had an ATL COM object that wrapped a simple c++/stl
member object.  I'd
>like to create a managed object that wraps the same

unmanaged member.  I
Quote:
>used the wizard to create the managed library, added the
files for the
>internal class (which is rather complex and includes
a  .lib) and the
>compilation goes ok, but the linker returns the output
below.

>Can anyone tell me what I have to do to get past this?

>TIA.

>Errors:

>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _free already
defined in
>LIBCMTD.lib(dbgheap.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: ___threadid
already defined in
>LIBCMTD.lib(tidtable.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _malloc
already defined in
>LIBCMTD.lib(dbgheap.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _isspace
already defined in
>LIBCMTD.lib(_ctype.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _strncpy
already defined in
>LIBCMTD.lib(strncpy.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _calloc
already defined in
>LIBCMTD.lib(dbgheap.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fclose
already defined in
>LIBCMTD.lib(fclose.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _realloc
already defined in
>LIBCMTD.lib(dbgheap.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _memmove
already defined in
>LIBCMTD.lib(memmove.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fflush
already defined in
>LIBCMTD.lib(fflush.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fopen
already defined in
>LIBCMTD.lib(fopen.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _atoi already
defined in
>LIBCMTD.lib(atox.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _isdigit
already defined in
>LIBCMTD.lib(_ctype.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _sprintf
already defined in
>LIBCMTD.lib(sprintf.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _gmtime
already defined in
>LIBCMTD.lib(gmtime.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _printf
already defined in
>LIBCMTD.lib(printf.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _exit already
defined in
>LIBCMTD.lib(crt0dat.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _fprintf
already defined in
>LIBCMTD.lib(fprintf.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __fsopen
already defined in
>LIBCMTD.lib(fopen.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _strncmp
already defined in
>LIBCMTD.lib(strncmp.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _vsprintf
already defined in
>LIBCMTD.lib(vsprintf.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _tolower
already defined in
>LIBCMTD.lib(tolower.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: _qsort
already defined in
>LIBCMTD.lib(qsort.obj)
>msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __stricmp
already defined in
>LIBCMTD.lib(stricmp.obj)

>.



Wed, 05 Oct 2005 05:03:54 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. problem of unmanaged exception in managed code C++

2. Referencing data from unmanaged code to managed code in C++ Wrapper class

3. Fatal Error C1010 in Mixing Managed C++ and Unmanaged C++ Code

4. How to link managed and unmanaged code

5. Linking Managed and Unmanaged Code

6. Debugging into managed c++ DLL that is being used by unmanaged code

7. C++ Dot net: calling managed method from unmanaged code

8. Possible vc++ bug: using c++ references to managed objects in unmanaged code

9. Debugging mixed managed/unmanaged c++ code

10. calling managed code from unmanaged code

11. Calling managed code from unmanaged Code

12. managed C++ wrapper around unmanaged C++ classes: causing StackOverflow exception

 

 
Powered by phpBB® Forum Software