LNK2005 Errors 
Author Message
 LNK2005 Errors

I have a solution consiting of about dozen VC++ projects. Projects are
either console apps or DLLs. No MFC. I tried to move the projects to
VS.Net2003 to use the latest C++ compiler. But couple of projects are stuck
at LNK2005 compile time errors. Here what I have done so far..

1. Opened VC6 solution in VS.Net2003 IDE
2. Accepted project conversion from VC6 format to VC7.1 No changes are made
to any project settings.
3. Did a rebuild.
4. I get the following errors

error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
error LNK2005: __CppxcptFilter already defined in MSVCRTD.lib(MSVCR71D.dll)
error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR71D.dll)
error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR71D.dll)
error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj)

This error list goes on and on..

What needs to be changed for VC7.1 builds.

Thanks,
Naveen



Sun, 09 Oct 2005 00:57:25 GMT  
 LNK2005 Errors
I think you are double linking.. sort of.  The old version of the CRT is
being linked in, as is the new one.  They are probably being duplicated in
your linker settings.  This can happen if you are manually including, say,
the old one, but the new one is implied during linkage unless you
specifically exclude it from the build.  Might want to check that avenue out
and see if it gets you anywhere.

hth,
-Dale



Quote:
> I have a solution consiting of about dozen VC++ projects. Projects are
> either console apps or DLLs. No MFC. I tried to move the projects to
> VS.Net2003 to use the latest C++ compiler. But couple of projects are
stuck
> at LNK2005 compile time errors. Here what I have done so far..

> 1. Opened VC6 solution in VS.Net2003 IDE
> 2. Accepted project conversion from VC6 format to VC7.1 No changes are
made
> to any project settings.
> 3. Did a rebuild.
> 4. I get the following errors

> error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
> error LNK2005: __CppxcptFilter already defined in

MSVCRTD.lib(MSVCR71D.dll)
Quote:
> error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR71D.dll)
> error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR71D.dll)
> error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj)

> This error list goes on and on..

> What needs to be changed for VC7.1 builds.

> Thanks,
> Naveen



Sun, 09 Oct 2005 02:34:24 GMT  
 LNK2005 Errors

Quote:

> 1. Opened VC6 solution in VS.Net2003 IDE
> 2. Accepted project conversion from VC6 format to VC7.1 No changes are
> made to any project settings.
> 3. Did a rebuild.
> 4. I get the following errors

> error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
> error LNK2005: __CppxcptFilter already defined in
> MSVCRTD.lib(MSVCR71D.dll) error LNK2005: _exit already defined in
> MSVCRTD.lib(MSVCR71D.dll) error LNK2005: _getenv already defined in
> MSVCRTD.lib(MSVCR71D.dll) error LNK2005: __xc_z already defined in
> MSVCRTD.lib(cinitexe.obj)

> This error list goes on and on..

The problem is that you are linking to some LIBs which where compiled with
VS6 (or before).

First upgrade this LIBs then you can upgrade you EXE/DLL also.

--
Greetings
  Jochen

  Do you need a memory-leak finder ?
  http://www.codeproject.com/useritems/leakfinder.asp



Sun, 09 Oct 2005 12:50:28 GMT  
 LNK2005 Errors
Thats the first thing that i did. I recompiled all the dependencies with
VC++7.1 And this stage there is nothing left to be recompiled. But i will
look into it again.

Thanks.
Naveen


Quote:

> > 1. Opened VC6 solution in VS.Net2003 IDE
> > 2. Accepted project conversion from VC6 format to VC7.1 No changes are
> > made to any project settings.
> > 3. Did a rebuild.
> > 4. I get the following errors

> > error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
> > error LNK2005: __CppxcptFilter already defined in
> > MSVCRTD.lib(MSVCR71D.dll) error LNK2005: _exit already defined in
> > MSVCRTD.lib(MSVCR71D.dll) error LNK2005: _getenv already defined in
> > MSVCRTD.lib(MSVCR71D.dll) error LNK2005: __xc_z already defined in
> > MSVCRTD.lib(cinitexe.obj)

> > This error list goes on and on..

> The problem is that you are linking to some LIBs which where compiled with
> VS6 (or before).

> First upgrade this LIBs then you can upgrade you EXE/DLL also.

> --
> Greetings
>   Jochen

>   Do you need a memory-leak finder ?
>   http://www.codeproject.com/useritems/leakfinder.asp



Sun, 09 Oct 2005 22:02:00 GMT  
 LNK2005 Errors

Quote:

> Thats the first thing that i did. I recompiled all the dependencies
> with VC++7.1 And this stage there is nothing left to be recompiled.
> But i will look into it again.

Just enable the Verbose output of the linker in the linker settings. Then
you will see who is referencing the old DLLs...

--
Greetings
  Jochen

   Do you need a memory-leak finder ?
   http://www.codeproject.com/useritems/leakfinder.asp



Mon, 10 Oct 2005 01:55:09 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. LNK2005 error

2. LNK2005 Errors

3. New COM interface causing LNK2005 error

4. Why do I get a LNK2005 error?

5. LNK2005 Error

6. CTypedPtrList gives LNK2005 error in ReleaseMinDependency for COM control

7. lnk2005 error msvcirtd.lib

8. LNK2005 Error

9. LNK2005 errors

10. LNK2005 error

11. LNK2005 Errors

12. LNK2005 errors

 

 
Powered by phpBB® Forum Software