error C4430 missing type specifier

hey guys,
i am wrinting this program and i am getting horrible errors.
this is the part where all the errors are caused:

this is var.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef VAR_H
#define VAR_H
#include <iostream>
#include <cstring>
using namespace std;

typedef enum {

	uu,
	tt,
	ff,
}TriValue;
class Variable { 
public:

	char name[8];
	TriValue value;
	Variable (const char * name);
	int setValue(TriValue v);

};
class LOr {
};
class LNot {};




#endif  


this is land.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef LAND_H
#define LAND_H
#include "var.h"
using namespace std;
class LAnd {

public:
	
	Variable *leftVar;
	Variable *rightVar;
	LAnd *leftAnd;
	LAnd *rightAnd;
	LOr *leftOr;
	LOr *rightOr;
	LNot *leftNot;
	LNot *rightNot;
	LAnd (Variable * left, Variable * right);
	LAnd (Variable * left, LAnd * right);
	LAnd (Variable * left, LOr * right);
	LAnd (Variable * left, LNot * right);

	LAnd (LAnd * left, Variable * right);
	LAnd (LAnd * left, LAnd * right);
	LAnd (LAnd * left, LOr * right);
	LAnd (LAnd * left, LNot * right);

	LAnd (LOr * left, Variable * right);
	LAnd (LOr * left, LAnd * right);
	LAnd (LOr * left, LOr * right);
	LAnd (LOr * left, LNot * right);

	LAnd (LNot * left, Variable * right);
	LAnd (LNot * left, LAnd * right);
	LAnd (LNot * left, LOr * right);
	LAnd (LNot * left, LNot * right);


};


#endif  


this is lor.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef LOR_H
#define LOR_H
#include "var.h"
using namespace std;

class LOr {
public:	
	Variable *leftVar;
	Variable *rightVar;
	LAnd *leftAnd;
	LAnd *rightAnd;
	LOr *leftOr;
	LOr *rightOr;
	LNot *leftNot;
	LNot *rightNot;
	LOr (Variable * left, Variable * right);
	LOr (Variable * left, LAnd * right);
	LOr (Variable * left, LOr * right);
	LOr (Variable * left, LNot *right);
};
#endif  



this is lor.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "lor.h"

LOr::LOr (Variable * left, Variable * right){
	leftVar=left;
	righVar=right;

	leftAnd=rightAnd=NULL;
	leftOr=rightOr=NULL;
	leftNot=rightNot=NULL;
	};
LOr::LOr (Variable * left, LAnd * right){

	leftVar=left;
	rightAnd=right;

	rightVar=NULL;
	leftAnd=NULL;
	leftOr=rightOr=NULL;
	leftNot=rightNot=NULL;
};
LOr::LOr (Variable * left, LOr * right){

	leftVar=left;
	rightOr=right;

	rightVar=NULL;
	leftOr=NULL;
	leftAnd=rightAnd=NULL;
	leftNot=rightNot=NULL;
};
LOr::LOr (Variable * left, LNot * right){};



this is what i am getting :

1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : error C2143: syntax error : missing ';' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : error C2086: 'int Variable' : redefinition
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : see declaration of 'Variable'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : error C2059: syntax error : ')'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : error C2470: 'right' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2027: use of undefined type 'LOr'
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\var.h(22) : see declaration of 'LOr'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2143: syntax error : missing ')' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2143: syntax error : missing ';' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2079: 'Variable' uses undefined class 'LOr'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2086: 'int Variable' : redefinition
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : see declaration of 'Variable'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2086: 'int *left' : redefinition
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : see declaration of 'left'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2143: syntax error : missing ';' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2059: syntax error : ')'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(11) : error C2470: 'right' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2027: use of undefined type 'LOr'
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\var.h(22) : see declaration of 'LOr'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2143: syntax error : missing ')' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2143: syntax error : missing ';' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2079: 'Variable' uses undefined class 'LOr'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2086: 'int Variable' : redefinition
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : see declaration of 'Variable'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2086: 'int *left' : redefinition
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : see declaration of 'left'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2143: syntax error : missing ';' before '*'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2059: syntax error : ')'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(21) : error C2470: 'right' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(31) : error C2027: use of undefined type 'LOr'
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\var.h(22) : see declaration of 'LOr'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(31) : error C2872: 'left' : ambiguous symbol
1>        could be 'c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(3) : int *left'
1>        or       'c:\program files (x86)\microsoft visual studio 9.0\vc\include\ios(210) : std::ios_base &std::left(std::ios_base &)'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(31) : error C2297: '*' : illegal, right operand has type 'int *'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(31) : error C2275: 'LNot' : illegal use of this type as an expression
1>        c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\var.h(24) : see declaration of 'LNot'
1>c:\users\admin\documents\visual studio 2008\projects\lab 8\lab 8\lor.cpp(31) : error C2448: 'LOr' : function-style initializer appears to be a function definition
1>Build log was saved at "file://c:\Users\Admin\Documents\Visual Studio 2008\Projects\lab 8\lab 8\Debug\BuildLog.htm"
1>lab 8 - 38 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


i know you are gonna hate me for this, the code is messy and terrible.
thank you guys in advance :)
Last edited on
You already defined classes LOr and LNot in header var.h

class LOr {
};
class LNot {};

But then you redefined LOr

1
2
3
4
5
6
7
8
9
10
11
#ifndef LOR_H
#define LOR_H
#include "var.h"
using namespace std;

class LOr {
public:	
	Variable *leftVar;
	Variable *rightVar;
...
};
closed account (Dy7SLyTq)
please label each file
but i used #ifndef and #define, i mean arent these two supposed to define if not defined only? thanks anyways i will try this now :)
i have three header files which are var.h , land.h , and lor.h and a c++ file called lor.cpp
closed account (Dy7SLyTq)
its a guard for the header
if i have a header called file.h then i can make the guards whatever i want
ie
1
2
3
#ifndef _NO
#define _NO
#endif 


just click edit on the post and label them.
closed account (Dy7SLyTq)
you need to include all of your headers in lor.cpp
thank you a lot i will try that now :)
Topic archived. No new replies allowed.