Using Dev-Cpp.
Error: parse error before * tokenCode:// in a header file Register *getReg(Vm *, int);
I think it means the * token in "Vm *".
Any ideas on what this means?
Using Dev-Cpp.
Error: parse error before * tokenCode:// in a header file Register *getReg(Vm *, int);
I think it means the * token in "Vm *".
Any ideas on what this means?
01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000
it either means "Register" is not a type, or "Vm" is not a type
i seem to have GCC 3.3.4
But how do i start it?
I dont have a menu for it or anything.
That's not the problem:
Code:// in the same header file struct REGISTER { unsigned long value; }; typedef struct REGISTER Register; // in a file included by the header file struct VM { Register a, b, c, d; char *bcode; unsigned int bcsize; unsigned int i; }; typedef struct VM Vm;
01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000
Hi,
Code:// in the same header file struct REGISTER { unsigned long value; }; typedef struct REGISTER Register; // in a file included by the header file struct VM { Register a, b, c, d; char *bcode; unsigned int bcsize; unsigned int i; }; typedef struct VM Vm;
have you made above declaration before using it ?
Code:// in a header file Register *getReg(Vm *, int);
Yes, of course. The structs are above the prototypes.
Update: if I change the "Vm *" to "int", (somehow!) Dev-Cpp compiles it, then if I change it to "Vm *" again, it compiles it that one time. Maybe it's a bug in GCC or MingW?
01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000
Here's the headers:
vm.h
register.hCode:#ifndef VM_H #define VM_H #include "register.h" struct VM { Register a, b, c, d; char *bcode; unsigned int bcsize; unsigned int i; }; typedef struct VM Vm; Vm *createVm(char *, int); int runVm(Vm *); #endif
If you haven't guessed, it's a VM. (Not a serious project; just having fun).Code:#ifndef REGISTER_H #define REGISTER_H #include "vm.h" #include "bc.h" struct REGISTER { unsigned long value; }; typedef struct REGISTER Register; Register *getReg(Vm *, int); // error here void setValue(Register *, unsigned long); #endif
Hope this helps.
01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000
[Commenting that out, and making other assumptions...] Why do these headers include each other? How about this?Code:Error E2209 register.h 5: Unable to open include file 'bc.h'Code:/* register.h */ #ifndef REGISTER_H #define REGISTER_H //#include "bc.h" struct REGISTER { unsigned long value; }; typedef struct REGISTER Register; #endifCode:/* vm.h */ #ifndef VM_H #define VM_H #include "register.h" struct VM { Register a, b, c, d; char *bcode; unsigned int bcsize; unsigned int i; }; typedef struct VM Vm; Vm *createVm(char *, int); int runVm(Vm *); Register *getReg(Vm *, int); void setValue(Register *, unsigned long); #endif
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*