Hi , i have the following problem
when i start make for my os project i have this error :
undefined reference to 'memcpy'
but i don't use memcpy
on my old system with gcc 3.2.2 it works fine
with gcc 3.3 it doesn't why ?
maybe the change between this two version is the problem
is there a command option to workarround this problem ?
reference to memcpy
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:reference to memcpy
GCC may need memcpy to perform language operations like structures copies (i.e. when you have struct stuff=other_stuff;). The easiest workaround is to provide your own memcpy function, for instance with
or any equivalent code you might find smarter (using rep stosb, or using integer moves rather than byte moves when both addresses are aligned on an integer boundary and n>4 ... whatever ...)
Code: Select all
static inline void *memcpy(void *dest, const void *src, int n) {
char *dst=dest;
for (;n;n--,dest++,src++)
*dst=*((char*)src);
return dest;
}
Re:reference to memcpy
Thanks a lot , it works fine
In order to understand , why the problem appears ?
I have not changed my source code when i have switched my systems. And with GCC 3.2, there was no error.
Does anymore function that i have to provide ?
In order to understand , why the problem appears ?
I have not changed my source code when i have switched my systems. And with GCC 3.2, there was no error.
Does anymore function that i have to provide ?
Re:reference to memcpy
It is hard to say why really. I'd think that both versions would have a memcpy() builtin. Have you changed the command line arguments? Are you building on the same OS with a different compiler or are there other differences? Were the compilers built the same?gedeon wrote: Thanks a lot , it works fine
In order to understand , why the problem appears ?
I have not changed my source code when i have switched my systems. And with GCC 3.2, there was no error.
Does anymore function that i have to provide ?
Upgrading to a new version of gcc doesn't usually break code; they are pretty good about that sort of thing. In general, gcc is a fantastic compiler.
Gas, on the other hand, is a monstrosity... but I digress.
Re:reference to memcpy
The code source didn't change
before
red hat 9, kdevelop 2.1.5, gcc 3.2.2
after
Suse 8.2 , kdevelop 2.1.5, gcc 3.3
strange !!!
before
red hat 9, kdevelop 2.1.5, gcc 3.2.2
after
Suse 8.2 , kdevelop 2.1.5, gcc 3.3
strange !!!