Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strncmp not a member of ''global namespace''

388 views
Skip to first unread message

Scoots

unread,
Dec 24, 2008, 2:24:48 PM12/24/08
to
Hi, I'm working on several projects and one of my previous projects
has mysteriously broken. I changed nothing in it, I just worked on
another project for about three days. In that time, the project now
no longer compiles with the following errors (in VS2008, no MFC)

2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
(25) : error C2039: 'strncmp' : is not a member of '`global
namespace''
2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
(25) : error C2873: 'strncmp' : symbol cannot be used in a using-
declaration

Interestingly, I'm not including cstringt.h at all. Rather, I'm
working with the independant atlstr.h. It worked perfectly about half
a week ago, I'm not sure what has changed. My other project is in an
entirely different filepath, so there is no include overlap, and I'm
not sure what my problem is. Any thoughts? I've bumped into some
other people that received this message, but usually in combination
with a ton of other functions also reporting errors. For me, this is
the only one. No other standard function reports an error, just
strncmp.

Nathan Mates

unread,
Dec 24, 2008, 2:32:12 PM12/24/08
to
In article <badd319d-9dc7-410d...@v4g2000yqa.googlegroups.com>,

Scoots <linki...@msn.com> wrote:
>2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
>(25) : error C2039: 'strncmp' : is not a member of '`global
>namespace''
>2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
>(25) : error C2873: 'strncmp' : symbol cannot be used in a using-
>declaration

Checking
http://msdn.microsoft.com/en-us/library/eywx8zcx(VS.71).aspx , did a
#include <string.h> disappear? You could try adding it before whatever
pulls in <cstring>.

Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein

Brian Muth

unread,
Dec 24, 2008, 2:38:02 PM12/24/08
to
Does including <string.h> not solve the problem?

"Scoots" <linki...@msn.com> wrote in message news:badd319d-9dc7-410d...@v4g2000yqa.googlegroups.com...

Scoots

unread,
Dec 24, 2008, 2:44:04 PM12/24/08
to
On Dec 24, 2:32 pm, nat...@visi.com (Nathan Mates) wrote:
> In article <badd319d-9dc7-410d-bd05-29ed3bad9...@v4g2000yqa.googlegroups.com>,

>
> Scoots  <linkingf...@msn.com> wrote:
> >2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
> >(25) : error C2039: 'strncmp' : is not a member of '`global
> >namespace''
> >2>c:\program files\microsoft visual studio 9.0\vc\include\cstring
> >(25) : error C2873: 'strncmp' : symbol cannot be used in a using-
> >declaration
>
>    Checkinghttp://msdn.microsoft.com/en-us/library/eywx8zcx(VS.71).aspx, did a

> #include <string.h> disappear? You could try adding it before whatever
> pulls in <cstring>.
>
> Nathan Mates
> --
> <*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/ 
> # Programmer at Pandemic Studios --http://www.pandemicstudios.com/

> # NOT speaking for Pandemic Studios. "Care not what the neighbors
> # think. What are the facts, and to how many decimal places?" -R.A. Heinlein

Thanks, but that's not it.

I tried putting it in before I bring in atlstr, and no go (though good
idea). Taking a look at cstring, I can see this:

// cstring standard header
#pragma once
#ifndef _CSTRING_
#define _CSTRING_
#include <yvals.h>

#ifdef _STD_USING
#undef _STD_USING
#include <string.h>
#define _STD_USING

#else /* _STD_USING */
#include <string.h>
#endif /* _STD_USING */


Which pulls in string.h anyway. Here's what follows and where the
error "appears"

g ::size_t; using ::memchr; using ::memcmp;

using ::memcpy; using ::memmove; using ::memset;
using ::strcat; using ::strchr; using ::strcmp;
using ::strcoll; using ::strcpy; using ::strcspn;
using ::strerror; using ::strlen; using ::strncat;
using ::strncmp; using ::strncpy; using ::strpbrk; <<Bam,
this line hates me.
using ::strrchr; using ::strspn; using ::strstr;
using ::strtok; using ::strxfrm;


I went a bit rampant with find/replace in my other projct but, um,
wouldn't affect a standard include. I can't figure this one out. Any
more ideas?

Scoots

unread,
Dec 24, 2008, 3:09:10 PM12/24/08
to
I went digging and apparently my included string.h WAS modified
yesterday. It's showing up as having date modified in explorer.
Where can I get the copy I originally had?

Alex Blekhman

unread,
Dec 24, 2008, 3:25:48 PM12/24/08
to

You can get it from the original VS installation disk. Also, there
is a trick I always do after fresh VS installation: set read-only
attribute for all PSDK/CRT/ATL/MFC include and source files. So,
if you occasionally try to change them during debug session or by
bulk find-and-replace operation, the system will warn you.

Alex


Scoots

unread,
Dec 24, 2008, 3:34:53 PM12/24/08
to

Yeah, the problem is that I don't have access to the disks because we
haven't officially adopted vs2008 yet and I'm the only one working
with it in my department... where everyone is on holiday. I was
wondering myself why they weren't read-only... Should have made a
backup of them. I tried manually adding the entry in, but no go.
Gaah, what a mess. Alright, well, I'm going to assume that's what the
problem is, thanks for your help.

Alex Blekhman

unread,
Dec 24, 2008, 3:56:00 PM12/24/08
to
"Scoots" wrote:
> Yeah, the problem is that I don't have access to the disks
> because we haven't officially adopted vs2008 yet and I'm the
> only one working with it in my department... where everyone is
> on holiday.

I guess you can download 90-days demo version of VS from MSDN.
Then you can hack out this file from the installation. Now, when
everybody is on holiday, the internet connection is fast as it
should be. :)

Alex


Scoots

unread,
Dec 24, 2008, 4:16:37 PM12/24/08
to
Okay, I managed to find a copy and do a repair. The modification has
been cleared and it no longer shows up as modified. This indeed fixed
the problem.

Thanks!

Tim Roberts

unread,
Dec 26, 2008, 5:33:33 PM12/26/08
to
Scoots <linki...@msn.com> wrote:
>
>Interestingly, I'm not including cstringt.h at all. Rather, I'm
>working with the independant atlstr.h.

<atlstr.h> includes <cstringt.h>, which in turn includes <atlsimpstr.h>.

This can make it a bit difficult to answer the musical question "now, where
is the real implementation of CStringA::Format?"
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

0 new messages