首页 > 解决方案 > 通过带有VS2019问题的WSL在Linux中编译控制台C++源代码

问题描述

在 Ubuntu WSL 中安装 g++ gdb 包后,我尝试通过 VS2019 在 WSL Linux 上编译我的 C++ 源代码(简单的 hello world),我可以调试代码并获取有关 vs2019 env 的信息,但是当尝试构建它时,我得到以下错误(可能是手册这个远程 WSL Linux 编译如何工作)

    Object reference not set to an instance of an object.
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <cmath>

using namespace std;
inline void keep_window_open() { char c; cin >> c; }
int main()
{
    cout << "hello from ConsoleApplicationC__!\n";
    keep_window_open();
    return 0;
}```

标签: c++visual-studio-2019windows-subsystem-for-linux

解决方案


推荐阅读