nubas

Hello, I am begginer in c++ language, please help me by telling whats wrong here:

#define DENSITY 1200
#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{
float weight,volume;
int size,letters;
char name[40];

printf("vardas \n");
scanf("%s",name);
printf("%s, koke mase tavo ",name);
scanf("%f",&weight);
size=sizeof(name);
letters=strlen(name);
volume=weight/DENSITY;

printf("kul, %s, tavo kuno turis yra %2.2f kubiniai metrai \n", name, volume);
printf("beto tavo varda sudaro %d raides \n", letters);
printf("ir jis uzhima komp. atmintyje %d baitu \n", size);

getch();

return 0;
}

c:\documents and settings\nubas\my documents\visual studio 2005\projects\testas\testas2\testas2\testas2.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\nubas\my documents\visual studio 2005\projects\testas\testas2\testas2\testas2.cpp(16) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data



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

n0n4m3

Hi,
all functions in c++ must have a return type and the main function must have int as a return type (although compilers such as VS accept other return types for the main function), so:

int main() {

would be enough to clear the error.





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

Simple Samples

For the first error (C4430) if you search these forums for "C4430 main" you will find:

Also, for compile errors and linker errors that you don't understand, look in the documentation for further explanation; such as:

I think the second error is separate from the first. See the following about it.






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

nubas

thank you guys!




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

li_guotao

要是 解 了此 能否及 通知一下。