Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
plz any one help me,why this types of error come.
when i declare a clss object inside a another class.
i include the class.but i got the error.
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\himansu\1dvrtestfront end\gdsapi.h
Posted

You can declare a function or prototype as:

MyFunc()
{
}

The compiler assumes the return value as int. But the comiler tells you that default return values are not supported!
int MyFunc()
{
  return 0;
}

or
void MyFunc()
{
}


is the right one.
Regards.
 
Share this answer
 
Comments
Albert Holguin 2-Apr-11 13:06pm    
my 5
samir.mourad@free.fr 4-Apr-11 22:05pm    
Of course this is the basis !!!

void, no return, C++ should declare by default int, so you don't know so error ?

The best : when no return void.

If return declare clearly the type.

The two last statments are purely C and not C++ : let's play with them.

Albert Holguin 4-Apr-11 22:41pm    
what?
Guyverthree 4-Apr-11 9:37am    
This is correct, they changed the standard so you must specific the return type from a function.
Without more info, I am guessing a bit, but I think you will find you need a forward reference to the class object before you can use it.

If this doesn't help, then we would need to see the relevant code fragment around the line the compiler is complaining about.
 
Share this answer
 
It looks like you edited the error message and removed the line number. Show us the complete error message and a few surrounding lines so we can help you.
 
Share this answer
 
mbue is correct, that's the reason you're getting the error... to elaborate a bit more, C used to support not explicitly defining a return type, C++ doesn't support this.

Valid in C, not valid in C++:
MyFunc(){}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900