0
這是我的代碼部分:100錯誤
#include "code.h"
CODEFILE * create_file()
{
CODEFILE * ret = (CODEFILE*)malloc(sizeof(CODEFILE));
ret->actual_instruction = 0; //'actual_instruction' : is not a member of 'CODEFILE'
ret->length = 0; //'length' : is not a member of 'CODEFILE'
ret->name = ""; //'name' : is not a member of 'CODEFILE'
ret->start = 0; /'start' : is not a member of 'CODEFILE'
return ret;
}
注意
#ifndef INTPROC_OPERATIONS_H
#define INTPROC_OPERATIONS_H
#define MAX_OPERATIONS 256
#define USED_OPERATIONS 8
#define MAX_OPCODE 256
#define OPCODE_TYPE unsigned char
#define OPERANDS_TYPE unsigned char
#include <malloc.h>
#include "executions.h"
typedef struct
{
OPCODE_TYPE opcode;
const char * name;
OPERANDS_TYPE operands_length;
int (* execute)(char * operands_start, char operands_length);
} OPERATION;
OPERATION * operations[MAX_OPERATIONS];
extern void init_operations();
#define operations_init() init_operations()
extern OPERATION parse_operation(OPCODE_TYPE opcode); //syntax error type
#endif
code.c:code.h是包括文件operation.h,我somwhere纏身那級聯包括使用typedef時可能會有問題...
因爲它寫在問題的標題,我收到來自Visual C++ 2010 100錯誤,當我試圖編譯此代碼。這些錯誤是由我的typedef中的一些錯誤引起的。
Error 95 error C2039: 'actual_instruction' : is not a member of 'CODEFILE'
Error 96 error C2039: 'length' : is not a member of 'CODEFILE'
Error 97 error C2039: 'name' : is not a member of 'CODEFILE'
Error 98 error C2039: 'start' : is not a member of 'CODEFILE'
...
Error 6 error C2059: syntax error : 'type'
Error 64 error C2059: syntax error : 'type'
Error 76 error C2059: syntax error : 'type'
包含此結構的頭文件被包含到C文件中(我也在其他頭文件中使用它)。像syntax error : 'type'
這樣的錯誤包含在包含文件中,其他包含在包含文件(包含成員)的文件中。任何人都知道問題在哪裏?請幫忙。
我沒有看到任何可能產生錯誤的代碼,您可以發佈違規代碼嗎? –
好的。在那。 – user35443
CODEFILE在哪裏定義? code.h include include header中的 – l4mpi