1
votes

I'm using Visual Studio 2010 and am trying to

#include <string>

in a C++ configured project. However, I get over 100 errors when I try to do so, as shown at the bottom of this post. I also tried including algorithm, iostream, and map to see if I got the same results (and I did), which leads me to believe it may have something to do with the STL or including anything other than .h files. I noticed that there are already STL files within the

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\

directory. By trying to use strings, am I somehow interfering with some kind of preset VS STL? Or is this some other issue?

I also tried getting the source code for the STL and putting it in a folder in the same directory as my .cpp file to reference it there but then I ran into a host of problems with the includes within the STL files. Any ideas?

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\crtdefs.h(436): error C2371: 'ptrdiff_t' : redefinition; different basic types 1>
c:\cats\executive\common_include\stddef.h(26) : see declaration of 'ptrdiff_t' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(32): error C2039: 'lldiv_t' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(32): error C2873: 'lldiv_t' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(34): error C2039: 'llabs' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(34): error C2873: 'llabs' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(34): error C2039: 'lldiv' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib(34): error C2873: 'lldiv' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\malloc.h(104): error C2375: 'calloc' : redefinition; different linkage 1>
c:\cats\executive\common_include\stdlib.h(89) : see declaration of 'calloc' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\malloc.h(105): error C2375: 'free' : redefinition; different linkage 1>
c:\cats\executive\common_include\stdlib.h(90) : see declaration of 'free' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\malloc.h(106): error C2375: 'malloc' : redefinition; different linkage 1>
c:\cats\executive\common_include\stdlib.h(91) : see declaration of 'malloc' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\malloc.h(108): error C2375: 'realloc' : redefinition; different linkage 1>
c:\cats\executive\common_include\stdlib.h(92) : see declaration of 'realloc' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\malloc.h(236): error C3861: 'free': identifier not found 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(55): error C2371: '_iobuf' : redefinition; different basic types 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdio(34) : see declaration of '_iobuf' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(65): error C2371: 'FILE' : redefinition; different basic types 1>
c:\cats\executive\common_include\stdio.h(133) : see declaration of 'FILE' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(76): warning C4005: 'stdin' : macro redefinition 1> c:\cats\executive\common_include\stdio.h(146) : see previous definition of 'stdin' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(77): warning C4005: 'stdout' : macro redefinition 1>
c:\cats\executive\common_include\stdio.h(147) : see previous definition of 'stdout' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(78): warning C4005: 'stderr' : macro redefinition 1> c:\cats\executive\common_include\stdio.h(148) : see previous definition of 'stderr' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(1110): error C2011: 'tm' : 'struct' type redefinition 1>
c:\cats\executive\common_include\time.h(69) : see declaration of 'tm' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wtime.inl(48): error C2664: '_wctime64' : cannot convert parameter 1 from 'const time_t *' to 'const __time64_t *' 1>
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wtime.inl(54): error C2664: 'errno_t _wctime64_s(wchar_t *,size_t,const __time64_t *)' : cannot convert parameter 3 from 'const time_t *' to 'const __time64_t *' 1>
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(1187): error C2375: 'memmove' : redefinition; different linkage 1>
c:\cats\executive\common_include\string.h(35) : see declaration of 'memmove' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\wchar.h(1223): error C3861: 'memmove': identifier not found 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2039: 'acosf' : is not a member of '
global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2873: 'acosf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2039: 'asinf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2873: 'asinf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2039: 'atanf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2873: 'atanf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2039: 'atan2f' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2873: 'atan2f' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2039: 'ceilf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2873: 'ceilf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2039: 'cosf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2873: 'cosf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2039: 'coshf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2873: 'coshf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2039: 'expf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2873: 'expf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2039: 'fabsf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2873: 'fabsf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2039: 'floorf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2873: 'floorf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2039: 'fmodf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2873: 'fmodf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2039: 'frexpf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2873: 'frexpf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2039: 'ldexpf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2873: 'ldexpf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2039: 'logf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2873: 'logf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2039: 'log10f' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2873: 'log10f' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2039: 'modff' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2873: 'modff' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2039: 'powf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2873: 'powf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2039: 'sinf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2873: 'sinf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2039: 'sinhf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2873: 'sinhf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2039: 'sqrtf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2873: 'sqrtf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2039: 'tanf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2873: 'tanf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2039: 'tanhf' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2873: 'tanhf' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2039: 'acosl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2873: 'acosl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2039: 'asinl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2873: 'asinl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2039: 'atanl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2873: 'atanl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2039: 'atan2l' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2873: 'atan2l' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2039: 'ceill' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2873: 'ceill' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2039: 'cosl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2873: 'cosl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2039: 'coshl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2873: 'coshl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2039: 'expl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2873: 'expl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2039: 'fabsl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2873: 'fabsl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2039: 'floorl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2873: 'floorl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2039: 'fmodl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2873: 'fmodl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2039: 'frexpl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2873: 'frexpl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2039: 'ldexpl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2873: 'ldexpl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2039: 'logl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2873: 'logl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2039: 'log10l' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2873: 'log10l' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2039: 'modfl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2873: 'modfl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2039: 'powl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2873: 'powl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2039: 'sinl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2873: 'sinl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2039: 'sinhl' : is not a member of 'global namespace'' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2873: 'sinhl' : symbol cannot be used in a using-declaration 1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): fatal error C1003: error count exceeds 100; stopping compilation ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

1
I mean, it's obviously not a compiler bug, and moving Standard Library files around willy-nilly isn't going to help. - John Dibling
If you're attempting to use a 3rd-part STL (such as stlports) you should consider putting its include folder ahead of the regular include path. Honestly I don't advise using a 3rd party port regardless. The one shipped with vs2010 is more than adequate. If you're not trying to use a 3rd party standard lib and this is exhibiting with the vs2010 std lib implementation, you have have accidentally dorked your default include config in some past (or current) project. - WhozCraig

1 Answers

1
votes

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\crtdefs.h(436): error C2371: 'ptrdiff_t' : redefinition; different basic types

Most likely this is a problem with how you have configured your project.

The first thing I would check is to make sure you have WIN64 defined (and WIN32 not defined) in your project settings.