第一次用DEV C++4.9.9.0,请教高手

lovesulast 2005-10-29 05:20:24
新建一个空工程(empty project),然后再新建源代码,他会提示是否在工程中添加新单元,选择是,
在编辑区域输入
#include <iostream.h>
void main()
{
cout<<"good";
}
居然不能运行,不知道什么原因,有DEV C++4.9.9.0环境的可以试一下。
(当然,其实很多方法写一个输出程序,但我就像用最简单的实现,不想用using namespace ;int main(int argc,char * argv[])......)
...全文
281 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wolf0403 2005-11-01
  • 打赏
  • 举报
回复
建议楼主找一本新的、符合 C++98 标准的教材重新学起。新标准库修改了标准库包含文件的名字,引入了 STL 和名字空间,并规范了 main 函数的签名。
JoyerHuang_悦 2005-10-31
  • 打赏
  • 举报
回复
对于初学者,加上一句using namespace std;是为了书写方便。。
但是,无论在什么时候,用std::cout都是对的,即使你using的其它namespace中也有cout.
所以,在最后写时,用了全称std::cout
Pigwen 2005-10-29
  • 打赏
  • 举报
回复
回复人: lovesulast() ( ) 信誉:100 2005-10-29 18:59:00 得分: 0


为什么要写成std::cout,直接写cout不行吗,不是已经包含了iostream了吗,cout是他的对象阿,谢谢


--------------------------------------------------------------------
cout是std名字空间中的,所以要用std::cout,还有一种办法就是用using namespace std;
K 2005-10-29
  • 打赏
  • 举报
回复
int main();
lovesulast 2005-10-29
  • 打赏
  • 举报
回复
高手请继续回答,回者有分
lovesulast 2005-10-29
  • 打赏
  • 举报
回复
为什么要写成std::cout,直接写cout不行吗,不是已经包含了iostream了吗,cout是他的对象阿,谢谢
JoyerHuang_悦 2005-10-29
  • 打赏
  • 举报
回复
一般来说,没必要建新的空工程的。。
如果想写DOS命令行的程序,你应该建立一个Console工程。。

在\DecCpp\Templates\这个目录下有相应的.txt文件,对应
不同项目的模版。你可以给C++的写一个这样的。。

#include<iostream>
#include<cstdlib>

using namespace std;

int main(int argc,char **argv){
////Your Code...
////
std::cout<<"Press any key to continue...";
std::cin.get();
}
//End of file.
lyfhq 2005-10-29
  • 打赏
  • 举报
回复
#include <iostream>
int main()
{
std::cout<<"good";
return 0;
}

这是最简单的实现方法了,因为是用g++编译的,C++的标准要求main()返回一个int。用void 不行。
lyfhq 2005-10-29
  • 打赏
  • 举报
回复
#include <iostream>
void main()
{
std::cout<<"good";
}
lovesulast 2005-10-29
  • 打赏
  • 举报
回复
自己顶一下
c语言编译程序 Version 4.9.9.1 * Many bug fixes * Improved editor Version 4.9.9.0 * Support for latest Mingw compiler system builds * Bug fixes Version 4.9.8.9 * New code tooltip display * Improved Indent/Unindent and Remove Comment * Improved automatic indent * Added support for the "interface" keyword * WebUpdate should now report installation problems from PackMan * New splash screen and association icons * Improved installer * Many bug fixes Version 4.9.8.7 * Added support for GCC > 3.2 * Debug variables are now resent during next debug session * Watched Variables not in correct context are now kept and updated when it is needed * Added new compiler/linker options: - Strip executable - Generate instructions for a specific machine (i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp, athlon-mp, winchip-c6, winchip2, k8, c3 and c3-2) - Enable use of processor specific built-in functions (mmmx, sse, sse2, pni, 3dnow) * "Default" button in Compiler Options is back * Error messages parsing improved * Bug fixes Version 4.9.8.5 * Added the possibility to modify the value of a variable during debugging (right click on a watch variable and select "Modify value") * During Dev-C++ First Time COnfiguration window, users can now choose between using or not class browser and code completion features. * Many bug fixes Version 4.9.8.4 * Added the possibility to specify an include directory for the code completion cache to be created at Dev-C++ first startup * Improved code completion cache * WebUpdate will now backup downloaded DevPaks in Dev-C++\Packages directory, and Dev-C++ executable in devcpp.exe.BACKUP * Big speed up in function parameters listing while editing * Bug fixes Version 4.9.8.3 * On Dev-C++ first time configuration dialog, a code completion cache of all the standard include files can now be generated. * Improved WebUpdate module * Many bug fixes Version

65,206

社区成员

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

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