使用eclipse编译报错

标签 c compiler-errors

在下面的头文件中我声明了一些函数:

    #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/

相关文章:

c - 将数组从文件 1 中的方法传递到文件 2 中的方法,而不在方法中使用额外参数

c - 不了解计算字符数组中数字的功能

c - 'address already in use' (EADDRINUSE) 与 'bind' 系统调用在不同上下文中的问题

将 24 位 RGB 转换为 ARGB16

intellij-idea - IntelliJ : “java connot find symbol class” when class is in same package

c - 无符号 96 位整数的任何预定义类型?

c# - 找不到 namespace 名称 'MvcSiteMapProvider'

c++ - 无法访问 Arduino 结构字段。错误 "exit status 1. xxxx does not name a type"

GCC 可以不提示 undefined reference 吗?

c# - 生成资源任务失败错误