Re: error C2375: 'strcpy' : redefinition; different linkage
On Thu, 2 Nov 2006 13:12:05 -0500, "Prasanna Padmanabhan"
<prasannap@citrixnospamtolerated.com> wrote:
When I do a debug build of our source code,
I get the following error
<path to VS8>\VisualStudio8\RTM\VC\include\exception(81) : error C2375:
'strcpy' : redefinition; different linkage
<path to VS8>\VisualStudio8\RTM\VC\include\string.h(73) : see declaration of
'strcpy'
It looks like we end up including the declaration of strcpy() from both the
"exception" and "string.h" header files and the compiler does not like it.
In retail versions, it does not give this error.
Can someone please tell me why?
#line 72 "<path to VS8>\VisualStudio8\RTM\VC\include\string.h"
char * __cdecl strcpy( char *_Dest, const char * _Source);
#line 81 "<path to VS8>\VisualStudio8\RTM\VC\include\exception"
extern "C" __declspec(dllimport) char * __cdecl strcpy( char *_Dst, const
char *_Src);
This is the only way I've been able to reproduce the problem:
#define __STDC_WANT_SECURE_LIB__ 0
#include <string.h>
#include <exception>
....
X>cl -MD -EHsc -c a.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for
80x86
Copyright (C) Microsoft Corporation. All rights reserved.
a.cpp
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\exception(81) : error
C2375: 'strcpy' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\string.h(73)
: see declaration of 'strcpy'
....
So I would suggest you look for definitions of __STDC_WANT_SECURE_LIB__ in
your code or compiler options; also see if your debug build is using /MDd
and your release build is not using /MD, because linking to the CRT DLL is
required for the problem to occur. You can report the problem to MS here
(use my example):
http://connect.microsoft.com/feedback/default.aspx?SiteID=210
Post the tracking link, and I'll confirm it.
--
Doug Harrison
Visual C++ MVP