473,698 Members | 1,875 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 33339
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
7517
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 for obvious reasons - specially for a large array of built-in types like int or something; so do...
35
12043
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
15941
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
11639
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
4862
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: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/n869.txt.gz
16
2801
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
21569
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 pointed to by the source pointer is volatile and not the pointer itself?
11
2023
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 warning messages. Sadly, this is not the most confusing part of the code. This
5
11140
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
8598
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9152
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7708
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4358
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
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
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.