#include <iostream>
using namespace std;
int main()
{
HelloWorld();
return 0;
}
void HelloWorld()
{
cout << "Hello, World" << endl;
}
我正在以下編譯錯誤與G ++:爲什麼我的HelloWorld函數未在此範圍內聲明?
l1.cpp: In function 'int main()':
l1.cpp:5:15: error: 'HelloWorld' was not declared in this scope
我喜歡這個問題是如何直接將StackExchange作爲一個「熱點問題」。 – surfasb
可能的重複[爲什麼原型是需要的,即使沒有任何類聲明?](http://stackoverflow.com/questions/8199081/why-prototype-is-required-even-without-any-class-declaration) –