jquery选中select控件:我在linux下写了一个C++程序,可无论如何也运行不出来。从网上也找不到如此初等的资料。

来源:百度文库 编辑:高校问答 时间:2024/04/28 12:56:02
#include <iostream>
main()
{
cout << "abc " <<endl;
return 0;
}
取名为cjj.cpp
然后
gcc cjj.cpp
为什么不能运行呢?

谢谢,哪位给我指点一下呢?
信息如下:
cjj.cpp: In function 'int main':
cjj.cpp: error : 'cout' undeclared (first use this function)
cjj.cpp: error: (each undeclared identifier is reported only once for each function it appears in.)
cjj.cpp:4:error:'endl'undeclared (first use this function)
请说明一下如何改,谢谢啊。
把改好的写到下面吧。
字真的不多啊。

1.编译c++的文件应该使用 g++而非gcc(如果用gcc应该指定语言)
2.你需要在#include<iostream>的下面加上 using namespace std; 或using std::cout;
3.main应改为int main()

编译指令:
g++ -o cjj cjj.cpp

-o cjj 表明输出到cjj

不告诉你(其实我也不知道)

不把信息贴出来怎么帮你解决啊?

using namespace std;
或std::cout
另外C++好像不支持默认返回类型为int,起码VC++.net里是这样。