在下面的头文件中我声明了一些函数:
#ifndef _MY_INT_FUNCTIONS_H_
#define _MY_INT_FUNCTIONS_H_
int intFcn (const void *key, size_t table_size);
void intPrint (const void *key);
int intCompare (const void *key1, const void *key2);
#endif // _MY_INT_FUNCTIONS_H_
但是我得到一个编译错误:
“预期的声明说明符或‘...’在‘size_t’之前”
关于 int intFcn 函数。
我使用的是 eclipse INDIGO 版本。
帮助任何人?
最佳答案
在 C++ 中 size_t
在 <cstddef>
中声明std
中的 header 命名空间。
#include <cstddef>
int intFcn (const void *key, std::size_t table_size);
在 C 中(在 C++ 中也是如此),它在 <stddef.h>
中声明:
#include <stddef.h>
int intFcn (const void *key, size_t table_size);
关于使用eclipse编译报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7177054/