- 论坛徽章:
- 0
|
[讨论]UNIX环境下的C++开发环境问题
[root@Linux-Host program]# more hello.c
include <iostream>;
int main()
{
std::cout<<"hello,new world! \n";
}
[root@Linux-Host program]# cc hello.c
hello.c:1: parse error before '<' token
[root@Linux-Host program]# g++ hello.c
hello.c:1: `iostream' was not declared in this scope
hello.c:2: syntax error before `int'
[root@Linux-Host program]# c++ hello.c
hello.c:1: `iostream' was not declared in this scope
hello.c:2: syntax error before `int'
[root@Linux-Host program]#
小弟刚刚开始学习c++,是书上看到的例子,然后想尝试一下,结果,无论如何也无法通过!
多谢各位了。。。
后记:
我编译通过了,有如下的问题:
1.源文件要存成.C或.cpp的形式;
2.编译c++的程序,一般要使用c++或g++的命令;
3.include前面要加上#; |
|