プロジェクトをコンパイルすると次のエラーが発生します。Cでコンパイルすると、ヘッダファイルにインポートエラーが発生する
./PC.h:15:12: error: unknown type name 'InstructionMemory'
PC *new_pc(InstructionMemory *memoria);
^
./PC.h:17:1: error: unknown type name 'InstructionMemory'
InstructionMemory *get_memory(PC *programCounter);
^
2 errors generated.
In file included from main.c:5:
./InstructionRegister.h:7:36: error: unknown type name 'BankRegister'
int opera(InstructionRegister *IR, BankRegister *bank);
しかし、これは私が理にかなっていないが、私は、ファイルを見て、彼らはヘッダファイルですので、私はあなたがヘッダファイルにする#includeを使用することはできませんことを知っています。だから私は何が間違っているのか分からない。
私PC.hファイルの内容があります:
typedef struct PC PC;
PC *new_pc(InstructionMemory *memoria);
int getpc(PC *programCounter);
InstructionMemory *get_memory(PC *programCounter);
char *fecth(PC *programCounter);
char *linea_actual(PC *programCounter);
私はコンパイルするために、次のmakefileを使用します。
CC = gcc
CFLAGS=-I
DEPS = ALU.h InstructionRegister.h Rebasing.h BankRegister.h MemoryInstruction.h ControlUnit.h PC.h
run: exect
./exect $(EX)
%.o: %.c $(DEPS)
$(CC) -c $< $(CFLAGS)
exect: ALU.c InstructionRegister.c Rebasing.c BankRegister.c MemoryInstruction.c main.c ControlUnit.c PC.c
gcc -o exect InstructionRegister.c Rebasing.c BankRegister.c MemoryInstruction.c main.c ControlUnit.c PC.c -I.
clean:
rm -f *.o
'PC.h'は、' InstructionMemory'を定義するものをすべて含める必要があります。または前方宣言を使用する –
ヘッダーファイルをコンパイルする必要はありません。 –
"*ヘッダファイルに#includeを使用できないことを知っています*" - そうです。 – melpomene