Dev-C++ 小问题

WindTech 2003-10-17 06:44:41
刚装了 Dev-C++ 5.0 beta 7 (4.9.8.0)


#include <iostream>

编译,不识别 cout 。看头文件包含路径也没错啊?
...全文
56 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
WindTech 2003-10-18
  • 打赏
  • 举报
回复
#include <iostream>
using namespace std;
也加了
WindTech 2003-10-18
  • 打赏
  • 举报
回复
注:已包含 #include "iostream.h"
WindTech 2003-10-18
  • 打赏
  • 举报
回复
问题依旧:

int
main (int argc, char *argv[])
{
char quit;

quit = '\0';
while (quit != 'q')
{
cout << "Hello ! This is a console app." << endl;
cout << "To create a console, go to Project Options and select" << endl;
cout << "\'Win32 Console\'." << endl;
cout << "Press q to quit " << endl;
cin >> quit;
}

return 0;
}


Out:

编译器: Default compiler
Building Makefile: "C:\Dev-Cpp\Examples\Hello\Makefile.win"
执行 make...
make.exe -f "C:\Dev-Cpp\Examples\Hello\Makefile.win" all
g++.exe -c Hello.cpp -o Hello.o -I"C:/DEV-CPP/include" -I"C:/DEV-CPP/include/c++" -I"C:/DEV-CPP/include" Hello.cpp:1:22: iostream.h: No such file or directory
Hello.cpp: In function `int main(int, char**)':
Hello.cpp:12: `cout' undeclared (first use this function)
Hello.cpp:12: (Each undeclared identifier is reported only once for each
function it appears in.)
Hello.cpp:12: `endl' undeclared (first use this function)
Hello.cpp:16: `cin' undeclared (first use this function)g++.exe Hello.o -o "Hello.exe" -L"C:/DEV-CPP/lib" -I"C:/DEV-CPP/include" -I"C:/DEV-CPP/include/c++" -I"C:/DEV-CPP/include" G__~1.EXE: Hello.o: No such file or directory
G__~1.EXE: no input files执行结束
awcoin 2003-10-18
  • 打赏
  • 举报
回复
using namespace std;

or

std::cout<<
ppgo 2003-10-18
  • 打赏
  • 举报
回复
#include <iostream.h>
或者
#include <iostream>
using namespace std;
tzk 2003-10-18
  • 打赏
  • 举报
回复
这样写:
#include <iostream>
using namespace std;
Wolf0403 2003-10-18
  • 打赏
  • 举报
回复
不要用 iostream.h 这个头文件。
RookieStar 2003-10-18
  • 打赏
  • 举报
回复
Three approaches to solve:
A1. using namespace std; //easiest way but easily clashes with other user-defined namespaces
A2. std::cout //regular way but it can be rather troublesome
A3. using std::cout; //The best way keeping the balance between A1 & A2
wenkejiujiu 2003-10-18
  • 打赏
  • 举报
回复
我是在这下面(dev c++4.9.6.0)下通过了的哈!
#include<iostream>
using namespace std;
int main (int argc, char *argv[])
{
char quit;

quit = '\0';
while (quit != 'q')
{
cout << "Hello ! This is a console app." << endl;
cout << "To create a console, go to Project Options and select" << endl;
cout << "\'Win32 Console\'." << endl;
cout << "Press q to quit " << endl;
cin >> quit;
}

return 0;
}
conchen 2003-10-17
  • 打赏
  • 举报
回复
using std::cout;
alongfly 2003-10-17
  • 打赏
  • 举报
回复
方法1:程序头中用
using namespace std;
方法2:
std::cout<<
mfs 2003-10-17
  • 打赏
  • 举报
回复
改用#include <iostream.h>也行.

像你这样的话就要用到名字空间,C++的新特性,慢慢来吧.呵呵.
ioriko2001 2003-10-17
  • 打赏
  • 举报
回复
在下面接着写 using namespace std;
把含cout的名字空间包含进去

64,282

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧