DecompileTestApplication_Program.h
#ifndef _DecompileTestApplication_Program_
#define _DecompileTestApplication_Program_
struct DecompileTestApplication_MyAnotherProgram;
#include <stdio.h>
typedef struct {
//Variables
int ind;
int a;
int b;
int __refs__;
} DecompileTestApplication_Program;
void DecompileTestApplication_Program_Plan( DecompileTestApplication_MyAnotherProgram* );
//error: expected ')' before '*' token
#endif
DecompileTestApplication_MyAnotherProgram.h
#ifndef _DecompileTestApplication_MyAnotherProgram_
#define _DecompileTestApplication_MyAnotherProgram_
struct DecompileTestApplication_Program;
#include <stdio.h>
typedef struct {
//Variables
DecompileTestApplication_Program* program;
int __refs__;
} DecompileTestApplication_MyAnotherProgram;
#endif
这又是我的 IL(C#\VB 编译代码)到 C 反编译器。 我尝试了几种方法来做到这一点,但没有获得任何成功的编译。 顺便说一句,我使用 Dev-Cpp 与原始 C 进行编译。
最佳答案
这是 C,不是 C++。声明/定义结构体不会创建新的类型名称。因此,第一个文件中的函数声明应该是
void DecompileTestApplication_Program_Plan(struct DecompileTestApplication_MyAnotherProgram);
或者你应该使用 typedef:
typedef struct DecompileTestApplication_MyAnotherProgram DecompileTestApplication_MyAnotherProgram;
在这种情况下,您必须省略第二个文件中的 typedef
关键字,只留下
struct XXX.... {
};
关于c 通过前向声明相互包含,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11497350/