使用gcc编译c ++程序

Poo*_*oja 0 c++ g++

#include<fstream>

using namespace std;
int 
main()
{
char name[30];
int marks;
ofstream fout("student.out");

cout<<"Enter name";
cin>>name;
cout<<"Enter marks secured:";
cin>>marks;

fout<<name<<endl;
fout<<marks<<endl;

return 0;
}
Run Code Online (Sandbox Code Playgroud)

请帮我用gcc编译上面的程序.当我编译这个程序时,我得到以下错误.

stdfile.cpp: In function 'int main()':
stdfile.cpp:12:1: error: 'cout' was not declared in this scope
stdfile.cpp:13:1: error: 'cin' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

Mat*_*Mat 8

std::cin并且std::cout<iostream>.请包含它,并编译您的C++代码g++,而不是gcc- 否则您将得到各种链接问题.