【发布时间】:2020-05-17 07:34:02
【问题描述】:
我正在尝试构建main.cpp 文件
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int count=0;
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
count++;
cout << word << " ";
}
cout << endl;
}
Using C++ and WSL in VS Code 但它结束了。这个例子我可以直接在 WSL 上构建
x86: g++-7 main.cpp -o main.x86_64
ARM64: aarch64-linux-gnu-g++ main.cpp -o main.arm64
我的 task.json 文件是
{
"type": "shell",
"label": "aarch64-linux-gnu-g++",
"command": "/usr/bin/aarch64-linux-g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.arm64"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
如何在 VSCode 中为远程 ARM 目标机器构建(交叉编译)并远程调试?
我有目标 ssh 机器的 IP 地址,并且在 Win10/WSL 上本地安装了“aarch64-linux-gnu-gcc”...我可以手动完成,这意味着交叉-编译它并 scp-ing 到目标并在那里执行。
【问题讨论】:
-
我不知道为什么会这样,但是将
tasks.json传递给 gcc 命令是错误的。tasks.json文件处于活动状态时,您是否使用了“编译文件”? -
是的,这是我的错误,并尝试在错误激活的文件上运行构建任务:(
标签: c visual-studio-code windows-subsystem-for-linux