'::memcpy' has not been declared

B

bisforbenson

I'm trying to compile things with gcc 4. After running the following
command:

% gcc -O3 -g -Wall -Wno-unused -DLINUX -D_REENTRANT -o ../../obj/egi.o
-I../../include/ -I... [bunch of include directories] -c egi.cpp

i get the following errors:

/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:79:
error: '::memcpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:80:
error: '::memmove' has not been declared
[and so on]

Anyone know how to fix this? I didn't get this with gcc 3.3...

TIA,
benson
 
R

red floyd

I'm trying to compile things with gcc 4. After running the following
command:

% gcc -O3 -g -Wall -Wno-unused -DLINUX -D_REENTRANT -o ../../obj/egi.o
-I../../include/ -I... [bunch of include directories] -c egi.cpp

i get the following errors:

/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:79:
error: '::memcpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:80:
error: '::memmove' has not been declared
[and so on]

Anyone know how to fix this? I didn't get this with gcc 3.3...

TIA,
benson

Did you include <memory.h> or <cmemory>?

If you used <cmemory>, memcpy is in namespace std
 
B

benson

It goes beyond just the memory functions. Below is more of the stuff
that i cut out. That the error is occuring in the cstring means that
something weirder is afoot. In any case, i tried including "memory.h"
(<cmemory> didn't work), but it didn't help.

thanks,
benson

/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:79:
error: '::memcpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:80:
error: '::memmove' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:81:
error: '::strcpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:82:
error: '::strncpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:83:
error: '::strcat' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:84:
error: '::strncat' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:85:
error: '::memcmp' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:86:
error: '::strcmp' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:87:
error: '::strcoll' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:88:
error: '::strncmp' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:89:
error: '::strxfrm' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:90:
error: '::strcspn' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:91:
error: '::strspn' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:92:
error: '::strtok' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:93:
error: '::memset' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:94:
error: '::strerror' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:95:
error: '::strlen' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:97:
error: '::memchr' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:
In function 'void* std::memchr(void*, int, size_t)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:101:
error: invalid conversion from 'const void*' to 'void*'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:101:
error: initializing argument 1 of 'void* std::memchr(void*, int,
size_t)'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:
At global scope:
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:103:
error: '::strchr' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:109:
error: '::strpbrk' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:115:
error: '::strrchr' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:121:
error: '::strstr' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In static member function 'static _Tp* std::__copy<true,
std::random_access_iterator_tag>::copy(const _Tp*, const _Tp*, _Tp*)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:300:
error: 'memmove' is not a member of 'std'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In static member function 'static _Tp* std::__copy_backward<true,
std::random_access_iterator_tag>::copy_b(const _Tp*, const _Tp*,
_Tp*)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:425:
error: 'memmove' is not a member of 'std'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In function 'void std::fill(unsigned char*, unsigned char*, const
unsigned char&)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:577:
error: 'memset' is not a member of 'std'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In function 'void std::fill(signed char*, signed char*, const signed
char&)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:585:
error: 'memset' is not a member of 'std'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In function 'void std::fill(char*, char*, const char&)':
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:593:
error: 'memset' is not a member of 'std'
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:
In function 'bool std::lexicographical_compare(const unsigned char*,
const unsigned char*, const unsigned char*, const unsigned char*)':
 
O

Old Wolf

red said:
I'm trying to compile things with gcc 4. After running the
following command:

% gcc -O3 -g -Wall -Wno-unused -DLINUX -D_REENTRANT -o ../../obj/egi.o
-I../../include/ -I... [bunch of include directories] -c egi.cpp

i get the following errors:

error: '::memcpy' has not been declared
error: '::memmove' has not been declared
[and so on]

Did you include <memory.h> or <cmemory>?
If you used <cmemory>, memcpy is in namespace std

Neither of those are standard headers.
memcpy and memmove are defined by <cstring>, which puts them
into namespace std, as you noted.
 
R

red floyd

Old said:
Neither of those are standard headers.
memcpy and memmove are defined by <cstring>, which puts them
into namespace std, as you noted.

Crap. For some reason, I thought they were standard. I stand corrected.
 
J

Jay Nabonne

It goes beyond just the memory functions. Below is more of the stuff
that i cut out. That the error is occuring in the cstring means that
something weirder is afoot. In any case, i tried including "memory.h"
(<cmemory> didn't work), but it didn't help.

thanks,
benson

/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:79:
error: '::memcpy' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:80:
error: '::memmove' has not been declared
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/cstring:81:
error: '::strcpy' has not been declared
<snip the rest>

(gcc-specific)

If your header files are like mine for gcc, then <cstring> includes
<string.h>, which should define those symbols that are missing.

Have you defined your own string.h and somehow gotten it into the system
path?

- Jay
 
B

benson

You're right that there's another string.h, but shouldn't the brackets
around <string.h> give precedence to the /usr/include directory? The
string.h in my code comes from FLTK. I'm not sure of the proper
workaround. Please advise.

thanks,
benson
 
R

Ron Natalie

benson said:
You're right that there's another string.h, but shouldn't the brackets
around <string.h> give precedence to the /usr/include directory? The
string.h in my code comes from FLTK. I'm not sure of the proper
workaround. Please advise.
The search path meanings for "" and <> is implementation defined.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top