Game Development Community

Please help a **COMPLETE** newb

by Expediter · in Technical Issues · 04/05/2006 (6:48 pm) · 3 replies

I just started learning C++ today . Went out and got a book plus some videos .. as funny as this question is going to be ... It is bother me to no end ...

I have VS 2005 and am dooing the "HelloWorld" starter program :) so ... in bolth the book AND the videos it says, to type out my program like this:


#include

main()
{
std::cout << "helloworld" << std::endl;
}

Now on the videos it says to expect a warning with this .. somethign to do with not returning a value.
I checked my code maney times ... ( not to hard of a task) and when I try to compile it, I get this:

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

Now .. as you can probably understand, this being the ABSOLUTE beginning program, I am extreamly afraid that if I am havinng such trouble with this. how much trouble will I be having later on ....

Is there something I am suposed to do that these resources are just Assumung I know. Or is VS 2005 different from other C++ programs and needs "int" infront of "main" and others do not ?


After you are done laughing could you throw me an answer to this ? I never expect to be able to program games .. (im more into art) BUT .. I would love to just play around with torque, and from what I have gathered I need to know at least SOME base in C++ ..... as you can see .. I have NO C++ skill at all.

About the author

Recent Threads


#1
04/05/2006 (7:20 pm)
What's happening, is you're not specifying what value your function main needs to return.
Because of this, it tries to guess, but doesnt support that.
the fix for this would be to simply type 'int' or 'void' without the quotes.
If you type int, you need to type 'return 0;' at the end of your function.
What the 'int' and 'return 0' mean is that your function is set up to return and integer. the 'return' statement is placed where you want the function terminated, and it will return the value that you type.
giving your function the return type 'void' means that the function will not return a value.
Generally, if you dont *need* the function returning some value, the simplest way to do things is to give your function the return type void.
Hope this helps.
#2
04/05/2006 (7:37 pm)
Yes thank you, that was fast :) that explained most everything I wanted to know why I would need "int" or "void" etc :) ... but the last thing I wanted to know is .... if thoes are needed .. why would a "beginners book" not say that :( ... it REALLY got me worried .. I was starting to think that I needed some sort of a beginner to beginners book.

well .. back to reading, and I promise I will not ask questions like this again. I was just starting to think that getting VS 2005 was a big mistake.
#3
04/05/2006 (8:44 pm)
Not at all, a good way to learn is to ask questions.
I'm also curious as to why the book didnt include it. Which book is it?
Also, i use VC2005, and outside the occasional hickups, it works awsome.