#include<iostream.h>
int main()
{
cout<<"Hello world!"<<endl;
return 0;
}
文件名为hello.cpp
使用g++ hello.cpp
之前已经安装了g++还有c++的库,可编译的时候出现错误,不明!!!!!
hello.cpp:1: error: stray ‘\357’ in program
hello.cpp:1: error: stray ‘\274’ in program
hello.cpp:1: error: stray ‘\203’ in program
hello.cpp:1: error: expected constructor, destructor, or type conversion before ‘<’ token
各位到底是怎么回事呢?????
使用g++时候出现错误!!!!(已解决!!)
-
- 帖子: 24
- 注册时间: 2007-03-19 22:00
使用g++时候出现错误!!!!(已解决!!)
上次由 tomlillite 在 2007-04-03 23:30,总共编辑 1 次。
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
-
- 帖子: 353
- 注册时间: 2007-04-03 9:52
- 联系:
ISO C++ 中的头文件是 没有h的
没有h时,需要使用cout 可以有下面2种方式
1. using namespace std;
2. 使用 std::cout
完整程序
或者
代码: 全选
#include <iostream>
1. using namespace std;
2. 使用 std::cout
完整程序
代码: 全选
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
cout << " Hello World!" <<endl;
return 0;
}
代码: 全选
#include <iostream>
int main(int argc, char** argv)
{
std::cout << " Hello World!" <<std::endl;
return 0;
}
-
- 帖子: 24
- 注册时间: 2007-03-19 22:00
多谢了!!!
因为在windows上用久了,vc6.0就那样编写的,所以……
多谢大家了哦!!!!

多谢大家了哦!!!!
