Prev: error C2065: 'PROTECTED_DACL_SECURITY_INFORMATION' : undeclared identifier
Next: Warnings about deprecated / insecure function usage
From: sip.address on 29 Feb 2008 09:53 Hi, I'm having a weird problem when using Visual Studio. I'm creating a small library with different utility classes. Thing is that everything compiles ok, but when I create a string.h / string.cpp files, I get the following errors: *** \microsoft platform sdk for windows server 2003 r2\include \guiddef.h(161) : error C3861: 'memcmp': identifier not found \microsoft platform sdk for windows server 2003 r2\include \stralign.h(101) : error C3861: 'wcscpy': identifier not found *** Also, if I used std::string internally in my string class (to make my class a wrapper over the std's string), then I'd get far more errors (please note that 100+ errors are displayed) *** 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : error C2039: 'memchr' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : error C2873: 'memchr' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : error C2039: 'memcmp' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : error C2873: 'memcmp' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2039: 'memcpy' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2873: 'memcpy' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2039: 'memmove' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2873: 'memmove' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2039: 'memset' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : error C2873: 'memset' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2039: 'strcat' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2873: 'strcat' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2039: 'strchr' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2873: 'strchr' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2039: 'strcmp' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : error C2873: 'strcmp' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2039: 'strcoll' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2873: 'strcoll' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2039: 'strcpy' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2873: 'strcpy' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2039: 'strcspn' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : error C2873: 'strcspn' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2039: 'strerror' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2873: 'strerror' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2039: 'strlen' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2873: 'strlen' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2039: 'strncat' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : error C2873: 'strncat' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2039: 'strncmp' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2873: 'strncmp' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2039: 'strncpy' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2873: 'strncpy' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2039: 'strpbrk' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : error C2873: 'strpbrk' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2039: 'strrchr' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2873: 'strrchr' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2039: 'strspn' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2873: 'strspn' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2039: 'strstr' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : error C2873: 'strstr' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : error C2039: 'strtok' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : error C2873: 'strtok' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : error C2039: 'strxfrm' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : error C2873: 'strxfrm' : symbol cannot be used in a using-declaration 1>c:\program files\microsoft visual studio 8\vc\include\new(53) : error C2732: linkage specification contradicts earlier specification for 'operator delete' 1> c:\program files\microsoft visual studio 8\vc\include \new(53) : see declaration of 'operator delete' 1>c:\program files\microsoft visual studio 8\vc\include\new(54) : error C2732: linkage specification contradicts earlier specification for 'operator new' 1> c:\program files\microsoft visual studio 8\vc\include \new(54) : see declaration of 'operator new' 1>c:\program files\microsoft visual studio 8\vc\include\new(80) : error C2733: second C linkage of overloaded function 'operator delete[]' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(80) : see declaration of 'operator delete[]' 1>c:\program files\microsoft visual studio 8\vc\include\new(83) : error C2733: second C linkage of overloaded function 'operator new[]' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(82) : see declaration of 'operator new[]' 1>c:\program files\microsoft visual studio 8\vc\include\new(88) : error C2733: second C linkage of overloaded function 'operator new' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(87) : see declaration of 'operator new' 1>c:\program files\microsoft visual studio 8\vc\include\new(91) : error C2733: second C linkage of overloaded function 'operator new[]' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(90) : see declaration of 'operator new[]' 1>c:\program files\microsoft visual studio 8\vc\include\new(94) : error C2733: second C linkage of overloaded function 'operator delete' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(93) : see declaration of 'operator delete' 1>c:\program files\microsoft visual studio 8\vc\include\new(97) : error C2733: second C linkage of overloaded function 'operator delete[]' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \new(96) : see declaration of 'operator delete[]' 1>c:\program files\microsoft visual studio 8\vc\include \crtdbg.h(1160) : error C2732: linkage specification contradicts earlier specification for 'operator new[]' 1> c:\program files\microsoft visual studio 8\vc\include \crtdbg.h(1160) : see declaration of 'operator new[]' 1>c:\program files\microsoft visual studio 8\vc\include \crtdbg.h(1177) : error C2732: linkage specification contradicts earlier specification for 'operator delete[]' 1> c:\program files\microsoft visual studio 8\vc\include \crtdbg.h(1177) : see declaration of 'operator delete[]' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(39) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(122) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(154) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(291) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(406) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(436) : error C2039: 'memcmp' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(436) : error C3861: 'memcmp': identifier not found 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(466) : error C2039: 'memchr' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(466) : error C3861: 'memchr': identifier not found 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(489) : error C2039: 'memset' : is not a member of '`global namespace'' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(489) : error C3861: 'memset': identifier not found 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(520) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(533) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(542) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(549) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(556) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(565) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(577) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(585) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(591) : error C2733: second C linkage of overloaded function 'std::_Traits_helper::copy_s' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \iosfwd(587) : see declaration of 'std::_Traits_helper::copy_s' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(594) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(601) : error C2733: second C linkage of overloaded function 'std::_Traits_helper::copy_s' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \iosfwd(597) : see declaration of 'std::_Traits_helper::copy_s' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(604) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(612) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(618) : error C2733: second C linkage of overloaded function 'std::_Traits_helper::move_s' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \iosfwd(614) : see declaration of 'std::_Traits_helper::move_s' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(621) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(628) : error C2733: second C linkage of overloaded function 'std::_Traits_helper::move_s' not allowed 1> c:\program files\microsoft visual studio 8\vc\include \iosfwd(624) : see declaration of 'std::_Traits_helper::move_s' 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(633) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(636) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(639) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(642) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(645) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(648) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(651) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(654) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(657) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(661) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(665) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(669) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(673) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(676) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(679) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(682) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(687) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(690) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(693) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\utility(15) : error C2894: templates cannot be declared to have 'C' linkage 1>c:\program files\microsoft visual studio 8\vc\include\utility(15) : fatal error C1003: error count exceeds 100; stopping compilation *** The really strange thing, at least to me, is that so far none of the other files in my library relies on string.h, so it seems that its sole existence confuses MSVC somehow. One solution I thought was avoiding the system include directory, but the problem is that some of the classes need access to win32 api, so I need it. Simple solution so far: just renaming string.h to stringxxx.h and everything works ok. But of course, I'd like to use string.h for clarity sake. Is there any workaround for this? Thanks in advance.
From: Tom Serface on 29 Feb 2008 10:35 My guess is that you'd fix your problem by just using a name that wasn't already taken as one of the standard names. Did you include string.h in your string.cpp file and include it in the project. That alone would be enough to attempt to cause the problem. Maybe you could call yours MyString.h or something like that. Tom <sip.address(a)gmail.com> wrote in message news:efd61d70-2a59-4024-be66-57ada343cc1c(a)41g2000hsc.googlegroups.com... > Hi, > > I'm having a weird problem when using Visual Studio. I'm creating a > small library with different utility classes. Thing is that everything > compiles ok, but when I create a string.h / string.cpp files, I get > the following errors: > > *** > \microsoft platform sdk for windows server 2003 r2\include > \guiddef.h(161) : error C3861: 'memcmp': identifier not found > \microsoft platform sdk for windows server 2003 r2\include > \stralign.h(101) : error C3861: 'wcscpy': identifier not found > *** > > Also, if I used std::string internally in my string class (to make my > class a wrapper over the std's string), then I'd get far more errors > (please note that 100+ errors are displayed) > > *** > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : > error C2039: 'memchr' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : > error C2873: 'memchr' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : > error C2039: 'memcmp' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(18) : > error C2873: 'memcmp' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2039: 'memcpy' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2873: 'memcpy' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2039: 'memmove' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2873: 'memmove' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2039: 'memset' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(19) : > error C2873: 'memset' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2039: 'strcat' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2873: 'strcat' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2039: 'strchr' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2873: 'strchr' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2039: 'strcmp' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(20) : > error C2873: 'strcmp' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2039: 'strcoll' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2873: 'strcoll' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2039: 'strcpy' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2873: 'strcpy' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2039: 'strcspn' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(21) : > error C2873: 'strcspn' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2039: 'strerror' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2873: 'strerror' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2039: 'strlen' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2873: 'strlen' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2039: 'strncat' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(22) : > error C2873: 'strncat' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2039: 'strncmp' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2873: 'strncmp' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2039: 'strncpy' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2873: 'strncpy' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2039: 'strpbrk' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(23) : > error C2873: 'strpbrk' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2039: 'strrchr' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2873: 'strrchr' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2039: 'strspn' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2873: 'strspn' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2039: 'strstr' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(24) : > error C2873: 'strstr' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : > error C2039: 'strtok' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : > error C2873: 'strtok' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : > error C2039: 'strxfrm' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\cstring(25) : > error C2873: 'strxfrm' : symbol cannot be used in a using-declaration > 1>c:\program files\microsoft visual studio 8\vc\include\new(53) : > error C2732: linkage specification contradicts earlier specification > for 'operator delete' > 1> c:\program files\microsoft visual studio 8\vc\include > \new(53) : see declaration of 'operator delete' > 1>c:\program files\microsoft visual studio 8\vc\include\new(54) : > error C2732: linkage specification contradicts earlier specification > for 'operator new' > 1> c:\program files\microsoft visual studio 8\vc\include > \new(54) : see declaration of 'operator new' > 1>c:\program files\microsoft visual studio 8\vc\include\new(80) : > error C2733: second C linkage of overloaded function 'operator > delete[]' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(80) : see declaration of 'operator delete[]' > 1>c:\program files\microsoft visual studio 8\vc\include\new(83) : > error C2733: second C linkage of overloaded function 'operator new[]' > not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(82) : see declaration of 'operator new[]' > 1>c:\program files\microsoft visual studio 8\vc\include\new(88) : > error C2733: second C linkage of overloaded function 'operator new' > not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(87) : see declaration of 'operator new' > 1>c:\program files\microsoft visual studio 8\vc\include\new(91) : > error C2733: second C linkage of overloaded function 'operator new[]' > not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(90) : see declaration of 'operator new[]' > 1>c:\program files\microsoft visual studio 8\vc\include\new(94) : > error C2733: second C linkage of overloaded function 'operator delete' > not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(93) : see declaration of 'operator delete' > 1>c:\program files\microsoft visual studio 8\vc\include\new(97) : > error C2733: second C linkage of overloaded function 'operator > delete[]' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \new(96) : see declaration of 'operator delete[]' > 1>c:\program files\microsoft visual studio 8\vc\include > \crtdbg.h(1160) : error C2732: linkage specification contradicts > earlier specification for 'operator new[]' > 1> c:\program files\microsoft visual studio 8\vc\include > \crtdbg.h(1160) : see declaration of 'operator new[]' > 1>c:\program files\microsoft visual studio 8\vc\include > \crtdbg.h(1177) : error C2732: linkage specification contradicts > earlier specification for 'operator delete[]' > 1> c:\program files\microsoft visual studio 8\vc\include > \crtdbg.h(1177) : see declaration of 'operator delete[]' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(39) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(122) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(154) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(291) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(406) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(436) : > error C2039: 'memcmp' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(436) : > error C3861: 'memcmp': identifier not found > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(466) : > error C2039: 'memchr' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(466) : > error C3861: 'memchr': identifier not found > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(489) : > error C2039: 'memset' : is not a member of '`global namespace'' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(489) : > error C3861: 'memset': identifier not found > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(520) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(533) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(542) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(549) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(556) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(565) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(577) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(585) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(591) : > error C2733: second C linkage of overloaded function > 'std::_Traits_helper::copy_s' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \iosfwd(587) : see declaration of 'std::_Traits_helper::copy_s' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(594) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(601) : > error C2733: second C linkage of overloaded function > 'std::_Traits_helper::copy_s' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \iosfwd(597) : see declaration of 'std::_Traits_helper::copy_s' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(604) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(612) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(618) : > error C2733: second C linkage of overloaded function > 'std::_Traits_helper::move_s' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \iosfwd(614) : see declaration of 'std::_Traits_helper::move_s' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(621) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(628) : > error C2733: second C linkage of overloaded function > 'std::_Traits_helper::move_s' not allowed > 1> c:\program files\microsoft visual studio 8\vc\include > \iosfwd(624) : see declaration of 'std::_Traits_helper::move_s' > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(633) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(636) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(639) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(642) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(645) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(648) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(651) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(654) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(657) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(661) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(665) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(669) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(673) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(676) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(679) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(682) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(687) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(690) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\iosfwd(693) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\utility(15) : > error C2894: templates cannot be declared to have 'C' linkage > 1>c:\program files\microsoft visual studio 8\vc\include\utility(15) : > fatal error C1003: error count exceeds 100; stopping compilation > *** > > The really strange thing, at least to me, is that so far none of the > other files in my library relies on string.h, so it seems that its > sole existence confuses MSVC somehow. One solution I thought was > avoiding the system include directory, but the problem is that some of > the classes need access to win32 api, so I need it. > > Simple solution so far: just renaming string.h to stringxxx.h and > everything works ok. But of course, I'd like to use string.h for > clarity sake. Is there any workaround for this? > > Thanks in advance.
From: Alf P. Steinbach on 29 Feb 2008 10:48 * sip.address(a)gmail.com: > Hi, > > I'm having a weird problem when using Visual Studio. I'm creating a > small library with different utility classes. Thing is that everything > compiles ok, but when I create a string.h / string.cpp files, I get > the following errors: > [snip] > > The really strange thing, at least to me, is that so far none of the > other files in my library relies on string.h, so it seems that its > sole existence confuses MSVC somehow. One solution I thought was > avoiding the system include directory, but the problem is that some of > the classes need access to win32 api, so I need it. > > Simple solution so far: just renaming string.h to stringxxx.h and > everything works ok. But of course, I'd like to use string.h for > clarity sake. Is there any workaround for this? > > Thanks in advance. Possibly the standard C library [string.h] is included instead of your [string.h]. To include the C library [string.h]: #include <string.h> To include your own, in the directory of the file containing this directive, #include "string.h" To avoid problems, choose some other name. Cheers, & hth., - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
From: sip.address on 29 Feb 2008 11:19 On Feb 29, 4:35 pm, "Tom Serface" <tom.nos...(a)camaswood.com> wrote: > My guess is that you'd fix your problem by just using a name that wasn't > already taken as one of the standard names. Did you include string.h in > your string.cpp file and include it in the project. That alone would be > enough to attempt to cause the problem. Maybe you could call yours > MyString.h or something like that. Hi there, Yes, of course I do #include "String.h" in the .cpp file, and also both files are included in the project. Renaming fixes this, but alas, given that this is intended to be a library providing some api to replace the natives, it would have been nice to call it "String.h".. Also, when compiling with other toolchains (gcc), this doesn't cause any problem.. Thanks anyway.
From: sip.address on 29 Feb 2008 11:21
Hi there, > Possibly the standard C library [string.h] is included instead of your [string.h]. > > To include the C library [string.h]: > > #include <string.h> > > To include your own, in the directory of the file containing this directive, > > #include "string.h" I do exactly that, I use "" for my own headers, and <> for system's. It seems the problem is in the include directory search order.. > To avoid problems, choose some other name. Yes, I think I'll end up doing that.. it surprises me that noone faced this issue before, as it's quite common to have a file named string.h in your own project. And I've been looking other libs and they indeed use string.h, but have makefiles so probably they avoid the issue some other way. Thanks. |