Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Problem with vectors in g++

Reply
Thread Tools

Problem with vectors in g++

 
 
JeanDean
Guest
Posts: n/a
 
      02-13-2007
I am trying to use "User-difned allocator " but on compilation it is
giving conflicts for memcopy
declarations with in string.h .

Please refer the below compile error log:

any suggestions how to resolve this???

g++ -g -DUNIX -DLINUX -DX86 -DCONIC_X86 -DCOMP_X86 -DDRAW_X86 -
DDR_X86 -DDEBUG -DDEBUGforCDC -DDEBUG_COMMANDLOG -DSUPPORT_IPS -
DTARGET_IRIPS -DTARGET_06S -DUSE_MEMCPY -DBUGFIX_RPCS_SPL_FLUSH -
DBUGFIX_POLYLINE_CLIP -I. -I../src -I../include -I../../include -I../
include/gps -I../../libge/include -I../../libdraw3/include -I../../
libipa/inc -I../../libdi/inc -c -o render.o ../src/render.c
In file included from /usr/include/g++-3/stl_algobase.h:48,
from /usr/include/g++-3/vector:30,
from ../include/pr_internal.h:15,
from ../include/object.h:9,
from ../include/spool.h:13,
from ../src/render.c:27:
/usr/include/string.h:242: declaration of C function `void memcpy
(void
*, const void *, unsigned int)' conflicts with
/usr/include/string.h:42: previous declaration `void *memcpy (void *,
const void *, unsigned int)' here

 
Reply With Quote
 
 
 
 
paul.joseph.davis@gmail.com
Guest
Posts: n/a
 
      02-13-2007
On Feb 13, 2:43 am, "JeanDean" <(E-Mail Removed)> wrote:
> I am trying to use "User-difned allocator " but on compilation it is
> giving conflicts for memcopy
> declarations with in string.h .
>
> Please refer the below compile error log:
>
> any suggestions how to resolve this???
>
> g++ -g -DUNIX -DLINUX -DX86 -DCONIC_X86 -DCOMP_X86 -DDRAW_X86 -
> DDR_X86 -DDEBUG -DDEBUGforCDC -DDEBUG_COMMANDLOG -DSUPPORT_IPS -
> DTARGET_IRIPS -DTARGET_06S -DUSE_MEMCPY -DBUGFIX_RPCS_SPL_FLUSH -
> DBUGFIX_POLYLINE_CLIP -I. -I../src -I../include -I../../include -I../
> include/gps -I../../libge/include -I../../libdraw3/include -I../../
> libipa/inc -I../../libdi/inc -c -o render.o ../src/render.c
> In file included from /usr/include/g++-3/stl_algobase.h:48,
> from /usr/include/g++-3/vector:30,
> from ../include/pr_internal.h:15,
> from ../include/object.h:9,
> from ../include/spool.h:13,
> from ../src/render.c:27:
> /usr/include/string.h:242: declaration of C function `void memcpy
> (void
> *, const void *, unsigned int)' conflicts with
> /usr/include/string.h:42: previous declaration `void *memcpy (void *,
> const void *, unsigned int)' here



Jean,

There are a couple options:
1) Rename your function to something other than memcpy.
2) Don't include strings.h in a file where you use your memcpy
function.
3) Place your version of memcpy in a namespace and access it with the
fully qualified namespace.
4) Place your version of mempcy in an object if it makes sense.

The option you should go with is probably option 1. Naming a function
the same as a standard function is generally a Bad Idea (TM).

HTH,
Paul Davis

 
Reply With Quote
 
 
 
 
JeanDean
Guest
Posts: n/a
 
      02-13-2007
On Feb 13, 6:03 pm, "(E-Mail Removed)"
<(E-Mail Removed)> wrote:
> On Feb 13, 2:43 am, "JeanDean" <(E-Mail Removed)> wrote:
>
>
>
> > I am trying to use "User-difned allocator " but on compilation it is
> > giving conflicts for memcopy
> > declarations with in string.h .

>
> > Please refer the below compile error log:

>
> > any suggestions how to resolve this???

>
> > g++ -g -DUNIX -DLINUX -DX86 -DCONIC_X86 -DCOMP_X86 -DDRAW_X86 -
> > DDR_X86 -DDEBUG -DDEBUGforCDC -DDEBUG_COMMANDLOG -DSUPPORT_IPS -
> > DTARGET_IRIPS -DTARGET_06S -DUSE_MEMCPY -DBUGFIX_RPCS_SPL_FLUSH -
> > DBUGFIX_POLYLINE_CLIP -I. -I../src -I../include -I../../include -I../
> > include/gps -I../../libge/include -I../../libdraw3/include -I../../
> > libipa/inc -I../../libdi/inc -c -o render.o ../src/render.c
> > In file included from /usr/include/g++-3/stl_algobase.h:48,
> > from /usr/include/g++-3/vector:30,
> > from ../include/pr_internal.h:15,
> > from ../include/object.h:9,
> > from ../include/spool.h:13,
> > from ../src/render.c:27:
> > /usr/include/string.h:242: declaration of C function `void memcpy
> > (void
> > *, const void *, unsigned int)' conflicts with
> > /usr/include/string.h:42: previous declaration `void *memcpy (void *,
> > const void *, unsigned int)' here

>
> Jean,
>
> There are a couple options:
> 1) Rename your function to something other than memcpy.
> 2) Don't include strings.h in a file where you use your memcpy
> function.
> 3) Place your version of memcpy in a namespace and access it with the
> fully qualified namespace.
> 4) Place your version of mempcy in an object if it makes sense.
>
> The option you should go with is probably option 1. Naming a function
> the same as a standard function is generally a Bad Idea (TM).
>
> HTH,
> Paul Davis


Actually it is conflicting in the string.h itself.
Line number 242 and 42 of string.h


Line 242 in string.h

#if defined __USE_BSD
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
extern void bcopy (__const void *__src, void *__dest, size_t __n)
__THROW;


Line 42 in string.h

/* Copy N bytes of SRC to DEST. */
extern void *memcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n)
__THROW;
/* Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
extern void *memmove (void *__dest, __const void *__src, size_t __n)
__THROW;

 
Reply With Quote
 
Jacek Dziedzic
Guest
Posts: n/a
 
      02-13-2007
JeanDean wrote:
> On Feb 13, 6:03 pm, "(E-Mail Removed)"
> <(E-Mail Removed)> wrote:
>> On Feb 13, 2:43 am, "JeanDean" <(E-Mail Removed)> wrote:
>>
>>
>>
>>> I am trying to use "User-difned allocator " but on compilation it is
>>> giving conflicts for memcopy
>>> declarations with in string.h .
>>> Please refer the below compile error log:
>>> any suggestions how to resolve this???
>>> g++ -g -DUNIX -DLINUX -DX86 -DCONIC_X86 -DCOMP_X86 -DDRAW_X86 -
>>> DDR_X86 -DDEBUG -DDEBUGforCDC -DDEBUG_COMMANDLOG -DSUPPORT_IPS -
>>> DTARGET_IRIPS -DTARGET_06S -DUSE_MEMCPY -DBUGFIX_RPCS_SPL_FLUSH -
>>> DBUGFIX_POLYLINE_CLIP -I. -I../src -I../include -I../../include -I../
>>> include/gps -I../../libge/include -I../../libdraw3/include -I../../
>>> libipa/inc -I../../libdi/inc -c -o render.o ../src/render.c
>>> In file included from /usr/include/g++-3/stl_algobase.h:48,
>>> from /usr/include/g++-3/vector:30,
>>> from ../include/pr_internal.h:15,
>>> from ../include/object.h:9,
>>> from ../include/spool.h:13,
>>> from ../src/render.c:27:
>>> /usr/include/string.h:242: declaration of C function `void memcpy
>>> (void
>>> *, const void *, unsigned int)' conflicts with
>>> /usr/include/string.h:42: previous declaration `void *memcpy (void *,
>>> const void *, unsigned int)' here

>> Jean,
>>
>> There are a couple options:
>> 1) Rename your function to something other than memcpy.
>> 2) Don't include strings.h in a file where you use your memcpy
>> function.
>> 3) Place your version of memcpy in a namespace and access it with the
>> fully qualified namespace.
>> 4) Place your version of mempcy in an object if it makes sense.
>>
>> The option you should go with is probably option 1. Naming a function
>> the same as a standard function is generally a Bad Idea (TM).
>>
>> HTH,
>> Paul Davis

>
> Actually it is conflicting in the string.h itself.
> Line number 242 and 42 of string.h
>
>
> Line 242 in string.h
>
> #if defined __USE_BSD
> /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
> extern void bcopy (__const void *__src, void *__dest, size_t __n)
> __THROW;
>
>
> Line 42 in string.h
>
> /* Copy N bytes of SRC to DEST. */
> extern void *memcpy (void *__restrict __dest,
> __const void *__restrict __src, size_t __n)
> __THROW;
> /* Copy N bytes of SRC to DEST, guaranteeing
> correct behavior for overlapping strings. */
> extern void *memmove (void *__dest, __const void *__src, size_t __n)
> __THROW;


That's pretty weird, since on line 242 you have 'bcopy'
and not 'memcpy'. Maybe someone happily #defined bcopy to memcpy?

HTH,
- J.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ primer statement about vectors containing vectors pauldepstein@att.net C++ 3 03-26-2008 06:22 PM
Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)? Ruby 0 09-14-2005 05:47 PM
Struts with vectors? Best way to solve this problem? Scott Phelps Java 3 06-10-2005 02:42 PM
Problem Based Passing Vectors Elements As Arguments Adam Hartshorne C++ 6 03-24-2005 11:33 AM
Problem with accessing objects of vectors ree C++ 9 11-09-2003 07:48 PM



Advertisments