Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails with "error: ‘memcpy’ is not a member of ‘std’" #5

Open
alexbevi opened this issue Mar 15, 2020 · 0 comments

Comments

@alexbevi
Copy link

rm -f *.o wtfile
g++  -std=c++11 -o wtfile wt_file_block.cpp wt_file_reader.cpp wt_file.cpp wt_utils.cpp -I. -lm
wt_file_block.cpp: In member function ‘int WTBlockReader::readCell(wt_cell_unpack_t*, int)’:
wt_file_block.cpp:25:10: error: ‘memcpy’ is not a member of ‘std’
     std::memcpy(&c_head, cell, sizeof(wt_cell_header_t));
          ^~~~~~
wt_file_block.cpp:25:10: note: suggested alternative: ‘decay’
     std::memcpy(&c_head, cell, sizeof(wt_cell_header_t));
          ^~~~~~
          decay
wt_file_block.cpp:34:18: error: ‘memcpy’ is not a member of ‘std’
             std::memcpy(unpack_c->data, (c_head.__chunk + 1), unpack_c->size);
                  ^~~~~~
wt_file_block.cpp:34:18: note: suggested alternative: ‘decay’
             std::memcpy(unpack_c->data, (c_head.__chunk + 1), unpack_c->size);
                  ^~~~~~
                  decay
wt_file_block.cpp:41:18: error: ‘memcpy’ is not a member of ‘std’
             std::memcpy(unpack_c->data, (c_head.__chunk + 2), unpack_c->size);
                  ^~~~~~
wt_file_block.cpp:41:18: note: suggested alternative: ‘decay’
             std::memcpy(unpack_c->data, (c_head.__chunk + 2), unpack_c->size);
                  ^~~~~~
                  decay
wt_file_block.cpp:68:18: error: ‘memcpy’ is not a member of ‘std’
             std::memcpy(unpack_c->data, cell_data, unpack_c->size);
                  ^~~~~~
wt_file_block.cpp:68:18: note: suggested alternative: ‘decay’
             std::memcpy(unpack_c->data, cell_data, unpack_c->size);
                  ^~~~~~
                  decay
Makefile:12: recipe for target 'wtfile' failed
make: *** [wtfile] Error 1

This can be fixed by just adding an include to wt_file_block.cpp:

diff --git a/wt_file_block.cpp b/wt_file_block.cpp
index 512819b..7f508c5 100644
--- a/wt_file_block.cpp
+++ b/wt_file_block.cpp
@@ -1,4 +1,5 @@
 #include <iostream>
+#include <cstring>
 #include <stdio.h>
 #include <string.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant