導航:首頁 > 源碼編譯 > 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交叉編譯設置相關的資料

熱點內容
devc指針編譯問題 瀏覽:998
支持dsd硬解壓音效卡 瀏覽:769
怎麼查看u盤加密區 瀏覽:181
台電加密是什麼格式 瀏覽:155
php論壇版塊在哪個文件夾 瀏覽:442
暗黑的伺服器為什麼維護 瀏覽:624
android內存溢出的原因 瀏覽:18
標志307的壓縮比是多少 瀏覽:636
伺服器啟動為什麼叫三聲 瀏覽:997
追風箏的人英文pdf 瀏覽:940
解壓小熊手機殼 瀏覽:346
成都市區建成面積演算法 瀏覽:661
智能家居單片機 瀏覽:97
買男裝用什麼app好 瀏覽:855
文件夾合並了怎麼拆開 瀏覽:261
波段副圖源碼無未來函數 瀏覽:90
livecn伺服器地址 瀏覽:259
程序員這個工作真的很吃香嗎 瀏覽:848
程序員和數學分析師待遇 瀏覽:681
壓縮氣彈簧怎麼拆 瀏覽:326