FW: Error from memcpy in cstring

Dingjun Chen Dingjun.Chen@geotechairborne.com
Thu Nov 9 13:00:34 GMT 2023


Hi, Ruoyao,


In my CMakeLists.txt, I specify below: 

include_directories(
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include/asm"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "${PROJECT_SOURCE_DIR}/include"
        "/home/Dingjun.Chen/usr/include/rtd"
        "/home/Dingjun.Chen/usr/include/gsc"
     )


The same errors still occurred and then I used the full path to specify in head files as follows:

#include </home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring>
#include </home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp/string.h>


The same errors still occurred.  I do not know why?  Did I do something wrong? 

I look forward to your help! 

Thank you very much for your reply! 

Best regards,

Dingjun 

......................................

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:97:11: error: 'strrchr' has not been declared in '::'
   97 |   using ::strrchr;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:98:11: error: 'strstr' has not been declared in '::'
   98 |   using ::strstr;
      |           ^~~~~~
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc: In member function 'int dongle_interface::Transform()':
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:133:5: error: 'memcpy' was not declared in this scope
  133 |     memcpy(aData1, aArrayToDecode, 8);
      |     ^~~~~~
.............................................







-----Original Message-----
From: Xi Ruoyao <xry111@xry111.site> 
Sent: Thursday, November 9, 2023 7:26 AM
To: Dingjun Chen <Dingjun.Chen@geotechairborne.com>; gcc-help@gcc.gnu.org
Subject: Re: FW: Error from memcpy in cstring

External Email Warning: Do not click any links or open any attachments unless you trust the sender and know the content is safe. From Geotech IT.



On Thu, 2023-11-09 at 20:24 +0800, Xi Ruoyao via Gcc-help wrote:
> On Thu, 2023-11-09 at 12:05 +0000, Dingjun Chen wrote:
> > In file included from
> > /home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:11:
> > /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-
> > musl/i686-
> > linux-musl/include/c++/13.2.0/cstring:77:11: error: 'memchr' has not 
> > been declared in '::'
> >    77 |   using ::memchr;
> >       |           ^~~~~~
>
> It should be defined by the libc (in your configuration, Musl) header 
> string.h.
>
> Check the output of
>
> echo '#include <cstring>'  | cpp -E -x c++ | grep -F 'string.h'

Correction: should be "i686-linux-musl-cpp" instead of "cpp" for your configuration.

> to see if the compiler is finding the correct string.h.  And view the 
> string.h file to see if there is something wrong.
>

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Gcc-help mailing list