Jump to content
  • Advertisement
Sign in to follow this  
ajas95

strange compiler error

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a demos sln that I use to hold a bunch of different projects, each of which is a different demo. I haven't really touched it in a while, but I just today tried to add a new project, and suddenly now none of them compile. They all bomb out when building the precompiled header. 95% of the files are all in a "shared" directory, including the precompiled header .h file (each vcproj builds its own stdafx.cpp file into its own .obj). Anyway, turning on /showincludes here is the output stream and eventual errors:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstring(18) :
    error C2039: 'memcpy' : is not a member of 'operator``global namespace'''
and:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\math.h(422) : 
    error C3861: 'sqrt': identifier not found, even with argument-dependent lookup
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\math.h(579) : 
    error C2365: 'sqrt' : redefinition; previous definition was a 'formerly unknown identifier'
with /showincludes:
Compiling...
stdafx.cpp
Note: including file: c:\projects\demos\shared\stdafx.h
Note: including file:  C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\iostream
Note: including file:   C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\istream
Note: including file:    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\ostream
Note: including file:     C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\ios
Note: including file:      C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xlocnum
Note: including file:       C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\yvals.h
Note: including file:         C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\use_ansi.h
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\errno.h
Note: including file:       C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\climits
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\limits.h
Note: including file:       C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdio.h
Note: including file:       C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdlib
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdlib.h
Note: including file:       C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\streambuf
Note: including file:        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xiosbase
Note: including file:         C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xlocale
Note: including file:          C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstring
Note: including file:           C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\string.h
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstring(18) : error C2039: 'memcpy' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstring(18) : error C2873: 'memcpy' : symbol cannot be used in a using-declaration

// the file it bombs in is cstring which looks like:
// 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>

 #if _GLOBAL_USING
_STD_BEGIN
using ::size_t; using ::memchr; using ::memcmp;
using ::memcpy; using ::memmove; using ::memset; // <<-- Bombs here.


Any thoughts? I've used this successfully for a long time, so it's strange for it to break now for no apparent reason. I can't think of anything!

Share this post


Link to post
Share on other sites
Advertisement
If you can tell me that this

using ::size_t; using ::memchr; using ::memcmp;
using ::memcpy; using ::memmove; using ::memset; // <<-- Bombs here.

is legal syntax then fair enough, but i am not familiar with it.


ace

Share this post


Link to post
Share on other sites
okay I've done more web searching on error C2039. It's apparently an esoteric compiler issue that no one understands. It's something that crops up on many large projects where this strange error weasels in on specific rare individuals.

And it's not necessarily 'memcpy'. It's anything that has some :: ('global namespace') prefix semantic, included generally in a precompiled header but not necessarily.

Anyway if anyone has an idea, I'd love to hear it. The solutions presented on the web were all extremely hacky, problem-specific, altering compiler headers or faking compiler-specific #defines, utter nonsense. The strangest part is that I've had this working for a long time On This Computer, the only thing I've changed is the monitor...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!