g ++使用#include-statements编译c ++脚本,无法运行.exe文件

时间:2017-10-10 23:26:27

标签: c++ c++11 g++

我在C ++中有以下脚本:

#include <iostream>
#include <vector>

using namespace std;

int main() {
    vector <string> markus = { "M", "A", "R", "K", "U", "S" };
    for (int i = 0; i < markus.size();i++) {
        cout << markus[i];
     }

     return 0;
}

我已经成功安装了g ++。当我尝试使用命令g++ -o test test.cpp编译此代码时,我没有错误。但是,当我尝试使用命令test.exe运行创建的test文件时,我收到错误消息“无法找到起始点”。首先,有一个很长的序列,然后是以下消息; “无法在动态链接库中找到该过程的起点”,以及test.exe的绝对路径。

如果我删除#include <vector>,请尝试以下代码;

#include <iostream>

using namespace std;

int main() {
    cout  << "Hello world";
    return 0;
}

,它很完美。

我很乐意帮助你。

0 个答案:

没有答案