无法使用Code :: Blocks在linux中编译C++

0 c++ linux codeblocks linux-mint

#include <iostream>

using namespace std;

int main(){
    int intake;

    cout<<"Enter the maximum number of intake in this session of 2015, September: ";
    cin>>intake;

    for(int i=20150900; i<intake+20150900; i++){
        cout<<"Enter the total percentage of Student ID numbered #"<<i<<": ";
    }

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

这是我的代码,当我在code :: blocks上编译它时会出现以下错误.我是linux OS的新手,所以我不太了解它是如何工作的.谢谢你的帮助!:) 错误信息:

g ++ -c /home/subbs/Desktop/entrance_exam/main.cpp -o /home/subbs/Desktop/entrance_exam/main.o/bin/sh:1:g ++:not found

sou*_*ner 7

您需要安装编译器.跑:

sudo apt-get install build-essential
Run Code Online (Sandbox Code Playgroud)

然后,再次尝试编译.

更新:

如果您在尝试运行该程序时,会收到如下错误消息:

Process terminated with status 255 
Run Code Online (Sandbox Code Playgroud)

这是因为xterm默认情况下代码块会尝试运行程序,而且可能是您没有安装它.要解决它,你必须去:

Settings > Environment

终端旁边的下拉菜单中启动控制台程序选择您的终端.在Linux Mint的情况下,它是gnome-terminal --disable-factory -t $TITLE -x

- 资源