Why is my HelloWorld function not declared in this scope?

You need to either declare or define the function before you can use it. Otherwise, it doesn't know that World() exists as a function.

You need to either declare or define the function before you can use it. Otherwise, it doesn't know that World() exists as a function. Add this before your main function: void you can move the definition of World() before your main(): #include using namespace std; void World() { cout.

You must declare the function before you can use it: #include using namespace std; void int main() { } void World() { cout.

But you can use a class member before you declare it. So this explanation is not satisfying. – Walter Nov 22 '11 at 22:12 10 @Walter My explanation covers specifically his problem, and since he's new, there is no point flooding him with so much information.

– Nacereddine Nov 22 '11 at 22:15.

You need to forward declare World() so main knows what it is. Like so: #include using namespace std; void int main() { } void World() { cout.

You need to have either a prototype of the function before the invocation or the whole function before it. So the first is: void int main() { } void World() { cout.

There is one more possibility for some reason nobody mentioned, namely using extern declaration: #include using namespace std; int main() { extern void return 0; } void World() { cout.

All these answers are correct, but strangely enough, this would have worked: struct { static int main() { World(); return 0; } /* note: World() not declared yet */ static void World() { std::cout.

1 There is nothing strange, all members of the class are already defined inside the body of member functions. – Gene Bushuyev Nov 23 '11 at 2:08 @Gene It's not immediately obvious (to a beginner/outsider anyway) why in namespace X { int a() { return b;} int b; } we have a problem, but not if we replace namespace by class (and add ; at the end). – Walter Nov 23 '11 at 11:08.

You have to put the function before the main function.

Rearrange World() so that it appears before main(): #include using namespace std; void World() { cout.

In C++ you need to define or at least declare the functions before calling them. What you are trying to do till now is something like this : int main() { cout using namespace std; void int main() { } void World() { cout.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions