【问题标题】:Im getting the error: expected '=', ',', ';', 'asm', or ''__attribute__' before 'void'我收到错误消息:在 'void' 之前需要 '='、','、';'、'asm' 或 ''__attribute__'
【发布时间】:2013-11-23 16:41:25
【问题描述】:

我在 .c 中的 preprocessText() 函数(如下)中遇到此错误,我不完全确定原因。从浏览来看,似乎大多数人都在某处遗漏了 { 或 ( 或 ; 等,但我很确定我没有。

#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "Assembler.h"

int main(int argc, char** argv) {
   // ...
   preprocessText(file, inter1);
   // ...
}

public void preprocessText(FILE* file, FILE* file2) { //error happens at this declaration
    // ...
}

我的头文件是:

#ifndef ASSEMBLER_H
#define ASSEMBLER_H
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stddef.h>
// ...
void preprocessText(FILE* file, FILE* file2);
#endif

【问题讨论】:

  • C中没有public关键字
  • 是的,我刚刚意识到这一点,谢谢

标签: c gcc token


【解决方案1】:

如果函数名在范围内,所有方法都可以被任何其他代码段隐式访问。 c中没有public关键字

【讨论】:

    【解决方案2】:

    您在“无效”之前有“公共”。记住,这是 C ;)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-20
      • 1970-01-01
      相关资源
      最近更新 更多