我尝试从Visual Studio 2015 社区中的https://github.com/zcbenz/BPlusTree编译代码。代码可以在gcc中编译,但是在VS中,我得到了
“bpt::internal_node_t”的默认构造函数不能被引用——它是一个被删除的函数
结构是这样的:
struct internal_node_t {
typedef index_t * child_t;
off_t parent; /* parent node offset */
off_t next;
off_t prev;
size_t n; /* how many children */
index_t children[BP_ORDER];
};
Run Code Online (Sandbox Code Playgroud)
中随处可见的引用bpt.cc,像这样
internal_node_t parent;
Run Code Online (Sandbox Code Playgroud)
我真的不明白这个消息是什么意思。如何使代码在VS中编译?
一些类型定义更新:
struct key_t {
char k[16];
key_t(const char *str = "")
{
bzero(k, sizeof(k));
strcpy_s(k, str);
}
};
typedef unsigned int size_t;
struct index_t {
key_t key;
off_t child; /* child's offset */
};
Run Code Online (Sandbox Code Playgroud)
我使用off_tin<sys\types.h>和 marco #define bzero(ptr, size) memset(ptr, 0, size)forbzero
我还写了另一个这样的程序:
#include <sys/types.h>
#include <string.h>
#define bzero(ptr, size) memset(ptr, 0, size)
struct key_t {
char k[16];
key_t(const char *str = "")
{
bzero(k, sizeof(k));
strcpy_s(k, str);
}
};
struct index_t {
key_t key;
off_t child; /* child's offset */
};
struct internal_node_t {
typedef index_t * child_t;
off_t parent; /* parent node offset */
off_t next;
off_t prev;
size_t n; /* how many children */
index_t children[20];
};
int main() {
internal_node_t t;
}
Run Code Online (Sandbox Code Playgroud)
这在 VS2015 中有效。
| 归档时间: |
|
| 查看次数: |
7888 次 |
| 最近记录: |