导航:首页 > 源码编译 > vscode交叉编译设置

vscode交叉编译设置

发布时间:2022-10-02 16:02:34

A. vscode怎么编译python

首先需要安装VScode Python插件。打开Python任意脚本,可以直接拖入。

点击左下角的扩展按钮,在弹出界面选择“显示扩展建议”。

然后点击第一个Python插件进行安装。安装需要几分钟。安装完成后点击重启。

接下来我们点击用户设置菜单。这时候会打开两个文件。

我们在左边文件Ctrl+F搜索Python关键字,找到pythonPath所在行

把这行拷贝到右边文件,修改Python所在路径。注意斜杠的方向,删除末尾逗号

保存文件。然后点击左边的资源管理器按钮,重新切换到我们的程序文件。

Ctrl+shift+B运行程序。这时候提示需要在文件夹目录下才能进行配置。于是我们点击打开文件夹按钮,打开程序所在文件夹。

Ctrl+shift+B运行程序。这时候会提示配置任务运行程序,点击配置。选择运行任意外部命令菜单。

在打开的tasks.json文件中,我们需要修改两个内容,路径和执行文件名。

好了,现在Python的代码可以Ctrl+shift+B直接运行了。文中的设置部分代码可以在文末下载。使用愉快。

B. VSCode如何设置,才能在VSC里打开php文件到浏览器

VSCode通过以下设置能在VSC里打开php文件到浏览器,方法如下:

准备材料:VisualStudio Code1.2

1、首先要想调试php代码,必须得先有php的相关编译器,只有安装了php的系统下,才能进行调试的。这里点击菜单栏的查看,选择扩展进入。


C. 为什么我的vscode写html 代码不能运行 Code language not supported or defined. 有没有大佬救救我

vscode写html 代码不能运行 Code language not supported or defined是没有正确调试造成的,解决方法为:

1、首先需要在这里打开vs code软件,新建后才能编译测试。

D. esp32 vscode lauch 设置

第一步:安装 VSCode C/C++ 扩展
1.在应用商店里搜索 C++
2.安装C/C++ IntelliSense, debugging, and code browsing
第二步:安装 VSCode ESP-IDF 扩展
1.在应用商店里搜索 Espressif
2.安装 Develop and debug applications for Espressif ESP32, ESP32-S2 chips with ESP-IDF (带乐鑫图标)
第三步:配置ESP-IDF 扩展
1.按 F1 或Ctrl+Shift+P 打开命令面板
2.输入 ESP-IDF: Configure ESP-IDF extension
加载初始设置时间较长,耐心等待
3.根据实际情况选择不同的配置方式
Express: IDF 版本 配置Python环境,扩展将安装IDF
Advanced: 手动配置已安装的开发环境
Using Existing Setup : 使用扩展检测出的环境
配置完成后显示:All settings have been configured. You can close this window.
第四步:创建项目模板,检测设置
1.按 F1 或Ctrl+Shift+P 打开命令面板 输入ESP-IDF:Create project 或按Ctrl+E+C
2.选择工程创建目录
3.选择模板类型
第五部:设置工作区的json文件
在settings.json文件中添加以下内容
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": ["/k", "c:\\esp\\esp-idf\\export.bat"],
"terminal.integrated.shell.linux": "/bin/bash",
"terminal.integrated.shellArgs.linux": ["--init-file", "~/esp/esp-idf/export.sh", "-i"],
"terminal.integrated.shell.osx": "/bin/bash",
"terminal.integrated.shellArgs.osx": ["--init-file", "~/esp/esp-idf/export.sh", "-i"],
"files.associations": {undefined
"*.md": "markdown",
"*.mdx": "tdx",
"stdio.h": "c"
},
可以在VSCode 终端中正常使用idf的各种命令。
第六步:编译工程
可以使用ESP扩展下的各个按钮完成项目的串口选择、项目配置、Full Clearn、编译、下载、监视
也可以使用命令行方式:
1.按Ctrl+` (~按键的位置)打开终端(第一次运行时扩展会有提示,选择允许 其实质就是运行~/esp/esp-idf/export.sh)
2.选择终止终端
3.重新打开终端 会看到export.sh运行的结果
Go to the project directory and run:
idf.py build
4.运行各种idf命令
第七部:下载程序并监测程序运行
1. 按Select Device Port 按钮 或运行 ESP-IDF:Device configuration命令
按提示选择/dev/ttyUSB1作为下载口
2.编译完成后,可使用下载按钮进行程序下载。此时会出现提示:
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB1'
原因:
$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 2月 3 11:21 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 2月 3 11:21 /dev/ttyUSB1
发现ttyUSB* 设备属于root用户 dialout 用户组,当前用户不属于dialout用户组
解决方案:
(1).执行以下命令
$sudo chmod 666 /dev/ttyUSB*
修改ttyUSB设备权限为其它用户可读可写。
缺点:电脑重启后,又会出现这种问题,还要重新设置
(2).为了能让普通用户也能使用串口,可以增加udev规则来实现
$sudo vim /etc/udev/rules.d/70-ttyusb.rules
增加如下内容:
KERNEL=="ttyUSB[0-9]*",MODE="0666"
保存,重新插入USB转串口,普通用户就能搞定了
缺点:该方法会让所有的普通用户都具有访问这些串口设备的权限,存在一定的安全隐患
(3).将目标用户加入dialout用户组,可以使用以下任意一个命令
$sudo usermod -aG dialout <目标用户名>
或:
sudo gpasswd --add <目标用户名> dialout
重启系统即可

第八部:跟踪调试程序
1.按 OpenOCD Server 按钮 输出提示:
❌ Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
❌ Error: no device foun
按照 https://sourceforge.net/p/openocd/code/ci/master/tree/README 文档解释做如下操作:
(1). 将~/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/share/openocd/contrib/
目录下的 60-openocd.rules 拷贝至 /etc/udev/rules.d/ 目录下
(2).确保当前用户属于 plugdev 用户组。 提示:运行 groups 命令可以查看当前用户所属的用户组
(3).重启系统
2.配置Debug 环境
参考:https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/DEBUGGING.md
注:该文档中的模板有坑。
问题:
使用 ESP-IDF Debug Adapter 配置时出现如下提示:
pygdbmi.gdbcontroller.NoGdbProcessError: gdb process has already finished with return code: 127
按照 esp_debug_adapter 说明文档 在~/.vscode/extensions/espressif.esp-idf-extension-0.6.1/esp_debug_adapter/ 目录下
$pip install -r requirements.txt
问题依然存在 暂无解决思路

使用 Microsoft C/C++ extension to debug 配置时出现如下提示:
error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
实质是系统中没有python2.7的库,解决:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install libpython2.7

问题解决
同时也解决了使用 ESP-IDF Debug Adapter 配置时出现的问题 故是否需要pip install …… 不能确定

在使用 Microsoft C/C++ extension to debug 配置时 会提示出现异常,不用理会可正常跟踪调试。

有时会提示
Error: couldn’t bind tcl to socket: Address already in use
则证明 刚刚启动的 进程未被终止。
解决办法:
a).查看当前活动进程
netstat为显示网络相关信息 a(all:默认显示所有,如果加了其他选项此项不生效) n(number:以数字形式显示) t(仅仅显示tcp连接),p(process:显示该项是由哪个程序建立起来的)
$ sudo netstat -antp
b). 强制杀死它(假设进程号为3560,-9为强制杀死)
$ sudo kill -9 3560
Debug正常运行时,状态栏由蓝色变为棕色。

附:scode的各个json文件
c_cpp_properties.json
======================================
{undefined
"configurations": [
{undefined
"name": "ESP-IDF",
"compilerPath": "${default}",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {undefined
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
}
}
],
"version": 4
}

settings.json
======================================
{undefined
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": ["/k", "c:\\esp\\esp-idf\\export.bat"],
"terminal.integrated.shell.linux": "/bin/bash",
"terminal.integrated.shellArgs.linux": ["--init-file", "~/esp/esp-idf/export.sh", "-i"],
"terminal.integrated.shell.osx": "/bin/bash",
"terminal.integrated.shellArgs.osx": ["--init-file", "~/esp/esp-idf/export.sh", "-i"],
"files.associations": {undefined
"*.md": "markdown",
"*.mdx": "tdx",
"stdio.h": "c"
},
"C_Cpp.clang_format_style": "Visual Studio",
"editor.formatOnSave": false,
"[cpp]": {undefined
"editor.quickSuggestions": true
},
"[c]": {undefined
"editor.quickSuggestions": true
},
"C_Cpp.intelliSenseEngine": "Tag Parser",
//配置下载接口
"idf.port": "/dev/ttyUSB1",
//配置下载方式
"idf.flashType": "UART",
//openOcd配置,根据开发板确定
"idf.openOcdConfigs": [
//新版建议用“board/XXX” 配置
"interface/ftdi/esp32_devkitj_v1.cfg",
"target/esp32.cfg"
]
}

launch.json
======================================
{undefined
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{undefined
"type": "espidf",
"name": "ESP_Debug",
"request": "launch",
"debugPort": 43474,
"logLevel": 2,
//模板中有坑的地方,模板内容为 "mode": "manual",
//这样不能自动启动 Debug Adapter
"mode": "auto",
"initGdbCommands": [
"target remote :3333",
"symbol-file ${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"set remote hardware-watchpoint-limit 2",
"mon reset halt",
"flushregs",
"thb app_main",
"c"
],
"env": {undefined
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
}
},
{undefined
"name": "GDB",
"type": "cppdbg",
"request": "launch",
"MIMode": "gdb",
"miDebuggerPath": "${command:espIdf.getXtensaGdb}",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"windows": {undefined
"program": "${workspaceFolder}\\build\\${command:espIdf.getProjectName}.elf"
},
"cwd": "${workspaceFolder}",
"environment": [{ "name": "PATH", "value": "${config:idf.customExtraPaths}" }],
"setupCommands": [
{ "text": "-enable-pretty-printing",
"ignoreFailures": true },
{ "text": "file '${workspaceFolder}/build/${command:espIdf.getProjectName}.elf'"},
{ "text": "target remote :3333" },
{ "text": "set remote hardware-watchpoint-limit 2"},
{ "text": "mon reset halt" },
{ "text": "thb app_main" },
{ "text": "flushregs" }
//{ "text": "c"}
],
"externalConsole": false,
"logging": {undefined
"engineLogging": true
}
}
]
}

tasks.json 这个文用系统生成的即可 略
————————————————
版权声明:本文为CSDN博主“FuShaofeng”的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/FuShaofeng/article/details/113633337

E. 关于VSCode的C/C++编译问题,主要关于头文件与库的引用

你查一下有哪些包含.h文件的include文件夹 全部加到配置里面就是了. 我的配置win10 + cygwin . 我只配置了win32节点

{
"configurations":[
{
"name":"Mac",
"includePath":[
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines":[],
"intelliSenseMode":"clang-x64",
"browse":{
"path":[
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders":true,
"databaseFilename":""
},
"macFrameworkPath":[
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name":"Linux",
"includePath":[
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines":[],
"intelliSenseMode":"clang-x64",
"browse":{
"path":[
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders":true,
"databaseFilename":""
}
},
{
"name":"Win32",
"includePath":[
"E:/Cygwin/usr/include",
"E:/cygwin/lib/gcc/i686-pc-cygwin/6.4.0/include",
"E:/cygwin/lib/gcc/i686-pc-cygwin/6.4.0/install-tools/include",
"${workspaceRoot}"
],
"defines":[
"_DEBUG",
"UNICODE"
],
"intelliSenseMode":"msvc-x64",
"browse":{
"path":[
"E:/Cygwin/usr/include",
"E:/cygwin/lib/gcc/i686-pc-cygwin/6.4.0/include",
"E:/cygwin/lib/gcc/i686-pc-cygwin/6.4.0/install-tools/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders":true,
"databaseFilename":""
}
}
],
"version":3
}

F. vscode使用教程是

vscode使用教程:

安装:

安装的东西没什么好说的,自行下载安装吧,伙计。

配置:

用户配置:

vscode的用户配置分3个级别,分别是默认配置、全局配置和工作区配置,优先级也依次递增。对于团队项目,一些规范可以通过项目目录下建一个.vscode/setting.json文件进行配置。

快捷键绑定:

参考官方文档,文档中列出了所有指令对应的快捷键。快捷键我只修改了两个与系统软件冲突的。

代码片段:

这个功能很像webstorm的live template的功能,虽然提示的时候没有webstorm那么精准和顺手,不过总的来说,够用。

设置语法遵循TextMate代码片段语法,你可以通过安装别人写好的snippet插件,如果别人写的snippet你用得不爽,那么自己写也简单。

之前使用这个代码片段有个痛点就是只能用方向键上下选择提示,如果能使用ctrl+n/p上下选择的话就更舒服了,没想到现在已经支持了。

另外,有没有人知道怎么设置代码提示内容,比如输入result提示了XPathResult是什么鬼。

插件:

4个月前刚知道vscode的时候,那时感觉插件还没有那么多,现在重新看了一下,真是应有尽有。牛逼啊!

这里介绍几个我用过觉得不错的插件

用户配置同步 Visual Studio Code Settings Sync。Git 历史 Git History。

文件图标 vscode-icons。缩进辅助线 Guides。

Visual Studio Code(以下简称vscode)是一个轻量且强大的代码编辑器,支持Windows,OS X和Linux。

内置JavaScript、TypeScript和Node.js支持,而且拥有丰富的插件生态系统,可通过安装插件来支持C++、C#、Python、PHP等其他语言。

G. 如何配置VSCode使它使用xetex编译tex文档以支持中文

LaTeX Workshop - Visual Studio Marketplace 我用的这个插件。
安装后需要到菜单栏里的File>Preferences>Settings>latex-workshop.latex.toolchain.里修改 LaTeX toolchain 的配置,插件的说明文档里有用pdflatex>bibtex>pdflatex>pdflatex 编译的示例:
"latex-workshop.latex.toolchain": [
{
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}, {
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}, {
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}, {
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}
]

我自己用目前一般用不到bibtex,只是用xelatex编译两次就够了,所以我就这样配置的
"latex-workshop.latex.toolchain": [
{
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}
]

<img src="https://pic2.mg.com/v2-_b.png" data-rawwidth="1591" data-rawheight="695" class="origin_image zh-lightbox-thumb" width="1591" data-original="https://pic2.mg.com/v2-_r.png">
(我不是程序员,所以vscode几乎全部都是用来写写数学笔记啥的,所以方便起见,我对编辑器的默认设置还做了两个修改,如图:1.开启自动换行 2.取消May 2017 (version 1.13)这个版本新加入的minimap的功能)
中文文档用xelatex,如果显示字体不好看,不知道是不是TeX Live默认中文字体比较吃藕的原因,我一般中文字体

H. 如何配置vscode的python编译环境

运行python代码
运行python代码见式三种:
运行python命令进入python工作环境输入表达式车即
创建保护python代码文件使用命令 python filename [参数]执行
Linux首行注释#!/usr/bin/env python3源文件加执行属性即直接执行
使用跨平台工具Visual Studio Code 作IDE
载并安装VS Code近(2016-7-15)VS Code更新比较快几新版本我现用1.3.0版
安装python插件:打VsCodeCtrl + p输入ext install python,稍等片刻发现关于python插件列表选择并安装我安装VSC官网介绍介绍语写:"*Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, snippets, and more"安装完插件智能提示python态语言某些候VSC识别变量类型运行才能确定类型算神仙没智能提示
配置python版本环境变量版本python通配置指定:依点击File->Preference->User Settings打两文件左边叫做Default.Settings右边叫做Setting.json左侧"python.pythonPath": "python"拷贝右侧并修改"python.pythonPath": "/usr/bin/python3"或任何想修改python目录即其设置左侧默认右侧设置左侧相同内容则覆盖左侧
设置运行配置:打或新建python源文件按快捷键Ctrl+Shift+B运行VSC提示No task runner configured.点击逗Configure Task Runner选择逗Others输入内容并保存:
{
"version": "0.1.0",
"command": "/usr/bin/python3",
"isShellCommand": true,
"args": ["${file}"],
"showOutput": "always"

I. vscode自动补全快捷键怎么设置

1、首先进入vscode的时候,在默认界面中就会看到快捷键,这些都是软件中定义的。

J. vscode怎么像devc++一样编译时加入命令

VSC运行代码需要手动配置环境,一般运行代码后执行的那一串代码是由Code Runner插件决定的,如果需要在编译的时候添加命令,可以选择在 设置 里的 拓展 更改settings.json
修改过后编译C++文件时编译器就会加上那条语句。

阅读全文

与vscode交叉编译设置相关的资料

热点内容
做程序员的没朋友吗 浏览:355
阿里云服务器传奇微端 浏览:922
phplinux时间 浏览:447
云服务器20性能 浏览:986
android强制系统横屏 浏览:280
怎么提前看未播出的电视剧app 浏览:666
cad转pdf图层 浏览:600
程序员接私活初级 浏览:434
全无油润滑压缩机 浏览:185
代码加密常用方法 浏览:953
安卓手机如何解除已禁用 浏览:396
算法的随机性 浏览:486
高中解压体育游戏 浏览:533
androidstudior丢失 浏览:345
命令行笔记 浏览:739
360目标文件夹访问拒绝 浏览:520
3b编程加工指令 浏览:790
c8051f系列单片机选型手册 浏览:773
南昌php程序员 浏览:514
bcs命令 浏览:447