Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!
Strona główna C++ C++ Hardware HTML i javascript Java Software SQL flag_united_kingdom flag_poland

C++ - error C4430: missing type specifier - int assumed.

Dodano: 2011-12-08

If you see error in compilation:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

First you need to verify, whose line number of code, regarding error. In Visual Studio double click on information about error, You will be automatically transferred to the line of the error. Often this problem is caused by not specifying the type, returned by the function. Bellow example:

int addX(int i); // w pliku nagłówkowym

addX(int i){
	// ...
	return i + x;

after compilation, you see the above error. Correct implementation below:

int addX(int i){
	// ...
	return i + x;

If declaration function in header file is the same like name in implementation file, error may be caused by not adding a library. You must check, that type returned by function is default type language c++, if you have additional error error C2143: syntax error : missing ',' before '*' it is not. Example bellow:

int addText(TCHAR* ttext);

Function declaration is correctness defined, but you must include library windows.h for type TCHAR.