使用DEV-C++进行命令行编译的设置问题

碧蓝右耳 2003-09-11 02:34:58
我下载安装了DEV-C++ V4.9.8.0
操作系统Windows2000 professional,装在C盘
DEV-C++安装在D:\TOOL\DEV-CPP
我的源代码在E;\CPP

现在情况是,我写了一个程序,001.cpp 如下:

#include <iostream.h>

int main()
{
cout << "hello world" << endl;
return 0;
}

我在命令行下
使用VC编译,进VC的目录,cl 001.cpp,通过
使用free的BCB5.5,生成了bcc32.cfg文件后,进BCB55目录,bcc32 001.cpp ,通过
在DEV-C++的IDE环境下,建立工程,加入001.cpp,编译运行通过

!!!但是
在命令行下,进入 d:\tool\dev-cpp\bin,
g++ 001.cpp
报错,声称 iostream: no such file or directory

即使加上 -I"d:\tool\dev-cpp\include",
或是 -I"d:/tool/dev-cpp/include",也没用

为何
为排除源文件的影响,我已经把 001.cpp复制到于编译器同一目录

这应该是GCC的设置吧,怎么设呢,我可不想每个小小的程序都生成一个工程文件
...全文
798 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxjddd 2003-09-19
  • 打赏
  • 举报
回复
<iostream.h> 不是标准支持的。

你应该用 <iostream>。没什么,找本“现代”一点的书看一看。
5852 2003-09-19
  • 打赏
  • 举报
回复
我也一直是编译的时候 出现
iostream.h: no such file or directory

真不知道是为什么
wengang 2003-09-18
  • 打赏
  • 举报
回复
g++ 的编译速度真的不敢恭维啊!
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
在Dev-Cpp 4.9.8.0 的IDE环境下,打开001.cpp文件
执行编译运行(F9),编译通过
在编译日志里的纪录是:

执行 g++.exe ...
g++.exe "d:\tool\dev-cpp\bin\001.cpp -o"d:\tool\dev-cpp\bin\001.exe" -I"d:\tool\dev-cpp\include\c++" -I"d:\tool\dev-cpp\include\mingw32" -I"d:\tool\dev-cpp\include\backward" -I"d:\tool\dev-cpp\
include" -L"d:\tool\dev-cpp\lib"

可见,Dev-Cpp执行的就是上面的命令,但是把上面的命令在命令行中输入时,就不可行了
Zeroins 2003-09-17
  • 打赏
  • 举报
回复
各位还是用过 4.9.8.0 再说吧
程序肯定没有问题
4960 也没问题
只有 4980 的命令行通不过
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
在IDE环境是可以编译通过的
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
没有用
我试过N次各种组合
包括 /和\的变化
iostream.h 和 iostream 的变化
中文输入和英文输入的变化
vitalgg 2003-09-17
  • 打赏
  • 举报
回复
GCC(MinGW)编译器中没有iostream.h这个文件.只有 iostream 文件.
你写的不是标准C++程序.
=========================
#include <iostream>

using namespace std;

int main (int argc, char *argv[])
{
cout << "Hello World!" << endl;
cout << "Press ENTER to continue..." << endl;
cin.get();
return 0;
}
===========================
-I"D:/tool/Dev-Cpp/include/c++"
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
如果换成 c++ -I"d:\tool\dev-cpp\include" 001.cpp
出错信息就成了
In file included from 001.cpp:1:
d:/tool/dev-cpp/include/c++/iostream:44:28: bits/c++config.h: No such file or di
rectory
In file included from d:/tool/dev-cpp/include/c++/ios:44,
from d:/tool/dev-cpp/include/c++/ostream:45,
from d:/tool/dev-cpp/include/c++/iostream:45,
from 001.cpp:1:
d:/tool/dev-cpp/include/c++/iosfwd:44:28: bits/c++config.h: No such file or dire
ctory
In file included from d:/tool/dev-cpp/include/c++/iosfwd:45,
from d:/tool/dev-cpp/include/c++/ios:44,
from d:/tool/dev-cpp/include/c++/ostream:45,
from d:/tool/dev-cpp/include/c++/iostream:45,
from 001.cpp:1:
d:/tool/dev-cpp/include/c++/bits/stringfwd.h:44:28: bits/c++config.h: No such fi
le or directory

……………………省略大批类似信息
In file included from d:/tool/dev-cpp/include/c++/bits/stl_alloc.h:86,
from d:/tool/dev-cpp/include/c++/memory:55,
from d:/tool/dev-cpp/include/c++/string:48,
from d:/tool/dev-cpp/include/c++/bits/localefwd.h:49,
from d:/tool/dev-cpp/include/c++/ios:48,
from d:/tool/dev-cpp/include/c++/ostream:45,
from d:/tool/dev-cpp/include/c++/iostream:45,
from 001.cpp:1:
d:/tool/dev-cpp/include/c++/bits/stl_threads.h: At global scope:
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:69: '__gthread_mutex_t' is used
as a type, but is not defined as a type.
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:79:2: #error __GTHREAD_MUTEX_INIT
or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer,
report problem to libstdc++@gcc.gnu.org.
d:/tool/dev-cpp/include/c++/bits/stl_threads.h: In member function `void
std::_Refcount_Base::_M_incr()':
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:86: `_M_ref_count_lock'
undeclared (first use this function)
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:86: `__gthread_mutex_lock'
undeclared (first use this function)
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:88: `__gthread_mutex_unlock'
undeclared (first use this function)
d:/tool/dev-cpp/include/c++/bits/stl_threads.h: At global scope:
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:158: '__gthread_mutex_t' is used

as a type, but is not defined as a type.
d:/tool/dev-cpp/include/c++/bits/stl_threads.h: In member function `void
std::_STL_mutex_lock::_M_acquire_lock()':
d:/tool/dev-cpp/include/c++/bits/stl_threads.h:192: `_M_lock' undeclared (first

use this function)
In file included from d:/tool/dev-cpp/include/c++/memory:55,
from d:/tool/dev-cpp/include/c++/string:48,
from d:/tool/dev-cpp/include/c++/bits/localefwd.h:49,
from d:/tool/dev-cpp/include/c++/ios:48,
from d:/tool/dev-cpp/include/c++/ostream:45,
from d:/tool/dev-cpp/include/c++/iostream:45,
from 001.cpp:1:
d:/tool/dev-cpp/include/c++/bits/stl_alloc.h: At global scope:
d:/tool/dev-cpp/include/c++/bits/stl_alloc.h:575: syntax error before `;' token
d:/tool/dev-cpp/include/c++/bits/stl_alloc.h:575: confused by earlier errors, ba
iling out
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
没用,一样的,出错信息为
001.cpp:1:20: iostream: No such file or directory
001.cpp: In function `int main()':
001.cpp:6: `cout' undeclared (first use this function)
001.cpp:6: (Each undeclared identifier is reported only
it appears in.)
001.cpp:6: `endl' undeclared (first use this function)


fierygnu 2003-09-17
  • 打赏
  • 举报
回复
不能用iostream.h,如下:
#include <iostream>
using namespace std;
xyuncn 2003-09-17
  • 打赏
  • 举报
回复
up
碧蓝右耳 2003-09-17
  • 打赏
  • 举报
回复
没有高人吗
vitalgg 2003-09-17
  • 打赏
  • 举报
回复
下载: MinGW.
http://prdownloads.sourceforge.net/mingw/MinGW-3.1.0-1.exe?download

安装,安装路径为 D:\tool\Dev-Cpp

安装完成后.
设置 系统变量 path=D:\tool\Dev-Cpp\bin;%path%

就可以用了. 象上面的源代码 只用 g++ hello.cpp 就可以搞定. 不用 -I -L等参数.

不过装个 Cygwin 应该更好用,我一直用她!
碧蓝右耳 2003-09-12
  • 打赏
  • 举报
回复
求高人指点
Zeroins 2003-09-11
  • 打赏
  • 举报
回复
^-^
偶的现象和楼主一样

高人指点之前,还是先用其他版本的吧

中秋快乐
碧蓝右耳 2003-09-11
  • 打赏
  • 举报
回复
主要问题是
无法包含头文件和库啊
Zeroins 2003-09-11
  • 打赏
  • 举报
回复
首先,g++ 的命名行:
g++ -o 001.exe 001.cpp

其次,偶现在还用的 4960
偶从 Bloodshed 下载的 4980,从命令行编译,也是搞不定
4960 就没问题
偶也不知是偶的设置哪儿有问题,还是别的什麽
dddd8888 2003-09-11
  • 打赏
  • 举报
回复
UP

64,637

社区成员

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

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