LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 954|回复: 2

谁给个 linux gcc "Hello, World!!!" 的全过程。。。?

[复制链接]
发表于 2003-11-9 15:54:17 | 显示全部楼层 |阅读模式
从 gnu gcc 主页看到
This question is asked approx. 5 times per week. Standard C++ Library
names are on namespace std. So you need std::cout, std::vector,
std::endl, std::sort and so on.

还是不会。
#include <iostream>
namespace std
                                                                                
int main(void)
{
    cout << "hello, world" << endl;
    return 0;
}

结果
# gcc -o hello hello.cpp
hello.cpp:4: error: syntax error before `int'

???
发表于 2003-11-9 18:39:27 | 显示全部楼层
vi test.cpp
i
#include <iostream>
using namespace std;
main()[cout<<"hello worl"<<endl;]

:w
g++ test.cpp -o test
./test
 楼主| 发表于 2003-11-9 19:10:33 | 显示全部楼层
非常感谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表