【发布时间】:2012-02-22 22:10:30
【问题描述】:
我在使用 Code::Blocks 时遇到了一些问题,这是编译后 / 时的输出;
3|iostream: No such file or directory|
4|error: syntax error before "namespace"|
|In function `main':|
8|error: `cout' undeclared (first use in this function)|
8|error: (Each undeclared identifier is reported only once|
8|error: for each function it appears in.)|
||=== Build finished: 5 errors, 1 warnings ===|
我的代码如下;
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
【问题讨论】:
-
这不会解决问题,但你应该说
using namespace std;,虽然不建议这样做。 -
你确定你已经创建了 C++ 控制台项目吗?
-
我该怎么做? (我是一个完整的新手)我只是做了空白项目?
-
文件 -> 新项目 -> 控制台应用程序 -> C++
-
Michal,将其发布为答案,因为它解决了我的问题!
标签: c++ compilation mingw codeblocks