473,573 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'::memcpy' has not been declared

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

Sep 7 '05 #1
7 33223
bi**********@gm ail.com wrote:
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
Sep 7 '05 #2
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(voi d*, 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(voi d*, 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<tru e,
std::random_acc ess_iterator_ta g>::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_bac kward<true,
std::random_acc ess_iterator_ta g>::copy_b(cons t _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(unsig ned 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(signe d 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::lexicograp hical_compare(c onst unsigned char*,
const unsigned char*, const unsigned char*, const unsigned char*)':

Sep 8 '05 #3
red floyd wrote:
bi**********@gm ail.com wrote:
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.

Sep 8 '05 #4
Old Wolf wrote:

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.
Sep 8 '05 #5
On Wed, 07 Sep 2005 17:02:24 -0700, benson wrote:
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

Sep 8 '05 #6
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

Sep 8 '05 #7
benson wrote:
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.
Sep 9 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7512
by: Samee Zahur | last post by:
Hi all, I'm a little confused - my guess is memcpy is no longer (or perhaps never was) a standard c++ function, since it has very little type check into it - and can potentially create havoc for user-defined types. Now my confusion is here - a simple instantiation of the standard copy algorithm can be quite slow compared to the older memcpy...
35
12026
by: Christopher Benson-Manica | last post by:
(if this is a FAQ or in K&R2, I didn't find it) What parameters (if any) may be 0 or NULL? IOW, which of the following statements are guaranteed to produce well-defined behavior? char src; char dst; memcpy( dst, src, 1 ); memcpy( NULL, src, 1 );
8
15887
by: Spacen Jasset | last post by:
given: memcpy( dest, src, 0 ) What happens when the size paramater of memcpy is 0? Do the src and dest have to be valid? It doesn't say anything about this in the standard as far as I can tell. So presumably they do have to be valid even when the size is 0.
70
11573
by: Rajan | last post by:
Hi, I am trying to simulate a memcpy like this void* mem_cpy(void* dest, void* src, int bytes) { dest = malloc(bytes); } Now if I want to copy the bytes from src to dest, how do I copy these bytes. I am stuck here.
1
4854
by: remove the CAPS | last post by:
Hi, all. This question came up in a code review: are null pointers legal as arguments to memcpy? That is, is the program at the end of this article strictly conforming? (Of course, I check the FAQ first and could not find an answer on point.) I don't have C89 or C99 handy, so I checked draft N869 from here:...
16
2781
by: Jeff | last post by:
Im trying to memcpy a buffer from a filled in simple structure. When I memcpy and then print the resulting buffer, I see 7 locations that have junk before my data starts. My data structure is: struct command_pkt { char command_num; char command; }; typedef command_pkt COMMAND;
18
21505
by: Mark | last post by:
Hi List, I want to write a function to copy some data out of a hardware buffer. The hardware can change the contents of this buffer without it being written to by my function. I want to use memcpy to unload the data. Do I need to specify the source data as volatile in this case? What is the correct syntax for specifying that the data...
11
2012
by: kuyper | last post by:
I've run across some rather peculiar code; here are the relevant lines that left me confused : unsigned char cr_file; unsigned char num_char; Note: this declaration actually works on our compiler, and it appears to be equivalent to giving a length of 1. The developer inserted compiler options into the make file to turn off the relevant...
5
11019
by: Tim | last post by:
How do I memcpy from a pointer to an array of floats in python? I get errors: NameError: global name 'row' is not defined I want to be able to get the row array element. In C I would normally place the address of row as the first argument. cdll.msvcrt.memcpy( row, pData, 256 )
0
7668
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7983
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5257
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3698
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3694
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2166
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.