From: Drew on
I recently rewrote some code to compile and link on VS2005 from
VS6, call it version 1 of the program. It now compiles and links
under both VS6 and VS2005. I then branched this code to version
2 and now get errors in version 2 under VS6:

D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : error C2732:
linkage specification contradicts earlier specification for 'delete'
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : see
declaration of 'delete'
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(35) : error C2732:
linkage specification contradicts earlier specification for 'new'
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(35) : see
declaration of 'new'
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(42) : error C2733:
second C linkage of overloaded function 'new' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(41) : see
declaration of 'new'
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(700) : error
C2733: second C linkage of overloaded function 'wmemchr' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(699) :
see declaration of 'wmemchr'
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(702) : error
C2733: second C linkage of overloaded function 'wcschr' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(701) :
see declaration of 'wcschr'
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(704) : error
C2733: second C linkage of overloaded function 'wcspbrk' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(703) :
see declaration of 'wcspbrk'
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(706) : error
C2733: second C linkage of overloaded function 'wcsrchr' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(705) :
see declaration of 'wcsrchr'
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(708) : error
C2733: second C linkage of overloaded function 'wcsstr' not allowed
D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(707) :
see declaration of 'wcsstr'
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(24) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(71) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(76) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(215) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(218) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(220) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(222) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(224) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(226) : error
C2894: templates cannot be declared to have 'C' linkage
D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(228) : error
C2894: templates cannot be declared to have 'C' linkage
etc. etc. etc.

I have verified that the offending file and the project file are identical
(I copied from version 1). What could possibly be going wrong?

Thanks,
Drew


From: Drew on
I should mention that clicking on either of these errors:

D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : error C2732:
linkage specification contradicts earlier specification for 'delete'
D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : see
declaration of 'delete'

points to the same line of source, namely:

void __cdecl operator delete(void *) _THROW0();

Drew

"Drew" <drew.nospam.myers(a)esrd.com> wrote in message
news:OaH5h2HnGHA.3340(a)TK2MSFTNGP02.phx.gbl...
>I recently rewrote some code to compile and link on VS2005 from
> VS6, call it version 1 of the program. It now compiles and links
> under both VS6 and VS2005. I then branched this code to version
> 2 and now get errors in version 2 under VS6:
>
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : error
> C2732: linkage specification contradicts earlier specification for
> 'delete'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : see
> declaration of 'delete'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(35) : error
> C2732: linkage specification contradicts earlier specification for 'new'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(35) : see
> declaration of 'new'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(42) : error
> C2733: second C linkage of overloaded function 'new' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(41) : see
> declaration of 'new'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(700) : error
> C2733: second C linkage of overloaded function 'wmemchr' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(699)
> : see declaration of 'wmemchr'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(702) : error
> C2733: second C linkage of overloaded function 'wcschr' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(701)
> : see declaration of 'wcschr'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(704) : error
> C2733: second C linkage of overloaded function 'wcspbrk' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(703)
> : see declaration of 'wcspbrk'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(706) : error
> C2733: second C linkage of overloaded function 'wcsrchr' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(705)
> : see declaration of 'wcsrchr'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(708) : error
> C2733: second C linkage of overloaded function 'wcsstr' not allowed
> D:\Program Files\Microsoft Visual Studio\VC98\Include\wchar.h(707)
> : see declaration of 'wcsstr'
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(24) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(71) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(76) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(215) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(218) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(220) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(222) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(224) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(226) : error
> C2894: templates cannot be declared to have 'C' linkage
> D:\Program Files\Microsoft Visual Studio\VC98\Include\iosfwd(228) : error
> C2894: templates cannot be declared to have 'C' linkage
> etc. etc. etc.
>
> I have verified that the offending file and the project file are identical
> (I copied from version 1). What could possibly be going wrong?
>
> Thanks,
> Drew
>


From: Igor Tandetnik on
"Drew" <drew.nospam.myers(a)esrd.com> wrote in message
news:OaH5h2HnGHA.3340(a)TK2MSFTNGP02.phx.gbl
> I recently rewrote some code to compile and link on VS2005 from
> VS6, call it version 1 of the program. It now compiles and links
> under both VS6 and VS2005. I then branched this code to version
> 2 and now get errors in version 2 under VS6:
>
> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : error
> C2732: linkage specification contradicts earlier specification for
> 'delete' D:\Program Files\Microsoft Visual
> Studio\VC98\Include\new(34) : see declaration of 'delete'

Somehow, you managed to #include <new> (perhaps indirectly) from inside
extern "C" {} block.
--
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


From: Drew on
Yes. It was included indirectly in a nested header of a nested header in an
extern "C" block. Thanks Igor.

Drew

"Igor Tandetnik" <itandetnik(a)mvps.org> wrote in message
news:%23RHE4UKnGHA.2384(a)TK2MSFTNGP02.phx.gbl...
> "Drew" <drew.nospam.myers(a)esrd.com> wrote in message
> news:OaH5h2HnGHA.3340(a)TK2MSFTNGP02.phx.gbl
>> I recently rewrote some code to compile and link on VS2005 from
>> VS6, call it version 1 of the program. It now compiles and links
>> under both VS6 and VS2005. I then branched this code to version
>> 2 and now get errors in version 2 under VS6:
>>
>> D:\Program Files\Microsoft Visual Studio\VC98\Include\new(34) : error
>> C2732: linkage specification contradicts earlier specification for
>> 'delete' D:\Program Files\Microsoft Visual
>> Studio\VC98\Include\new(34) : see declaration of 'delete'
>
> Somehow, you managed to #include <new> (perhaps indirectly) from inside
> extern "C" {} block.
> --
> 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
>