Error C4430 Missing Type Specifier

1
2
3
testbed.h(10): error C2143: syntax error : missing ';' before '*'
testbed.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
testbed.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


Error is above. Whatever I do, I could not fix this issue. I don't know why compiler does not accept my object which is called "algorithm". I also have a "SelectionAlgorithm" class.

Need your help. Only error I have is this. If it would be fixed, everything will be ok. Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include <string>
using namespace std;

class TestBed 
{
private:
	SelectionAlgorithm *algorithm;
public: 
	void execute();
	void setAlgorithm(int type, int k);
	TestBed();
	~TestBed();
};

#endif
There is no type SelectionAlgorithm declared before. So compiler does not know what is it.
Hi,

Try getting rid of line 2, importing entire namespaces in a header file is a bad idea. As is using the entire std namspace anywhere. There is bound to be a std::algorithm somewhere, seen as algorithms are a major part of the STL.

Prepend all the std stuff with std::

Hope all is well.

Edit: Do you need to include the header file for SelectionAlgorithm ?
Last edited on
Still I'm confused. I deleted namespace std. I don't know how can I define SelectionAlgorithm class in TestBad (h or cpp) class.
Hi,

If SelectionAlgorithm is a class, then it should have its declaration in a SelectionAlgorithm.h file, along with its implementation in SelectionAlgorithm.cpp file. Then include the header file in your TestBed.h file

Do you need to include the string header in your file? - only include what you need.

Hope all goes well
Topic archived. No new replies allowed.