c - 我收到错误 : expected '=' , ',' 、 ';' 、 'asm' 或 '' __attribute_ _' before ' void'

标签 c gcc token

我在 .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 - 我收到错误 : expected '=' , ',' 、 ';' 、 'asm' 或 '' __attribute_ _' before ' void',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20164930/

相关文章:

c++ - 声明指针的类型?

c - 为什么 struct addrinfo 仅在定义了 __USE_XOPEN2K 时才定义?

c - 在多进程 scanf 的 MPI 中只接受一次输入并将垃圾值分配给其他?

c++ - 将下载的 C++ 源代码添加到我的项目时的良好做法

c - 段故障错误:11 Known lines with Error

java - 如何获取GWT中最后一个历史记录 token

c - HDLC 扩展寻址

c - 函数的意外返回值

c++ - 编译错误: solution.c:20:5: error: expected identifier or ‘(’ before ‘{’ token {

c - 字符数组的初始化字符串太长 C