簡體   English   中英

如何使用 Visual Studio 為 Raspberry Pi 調試 Linux TUI 應用程序

[英]How to debug Linux TUI applications for Raspberry Pi using Visual Studio

我一直在編寫一個 C++ TUI 應用程序,以使用 ncurses 庫在我的樹莓派終端中運行。 我一直在使用 Visual Studio 中的 linux 遠程 C++ 開發附加組件來執行此操作,但在調試 go 時遇到了一些障礙。

Built into visual studio there is a linux console window which displays the output of the ssh connection visual studio makes with the raspberry pi, so if you're writing a console interface using nothing but std::cout and std::cin it does the用於交互和調試應用程序的工作。 然而Ncurses不使用標准輸入和output流,因此用代碼編寫的ncurses接口不會出現在linux控制台window中。

Therefore, essentially what I want to be able to do is interact with the output of my application on my raspberry pi screen when I build and run my linux solution in visual studio instead of using the linux console window. 我想要一個終端 window,我的 ncurses 應用程序在調試模式下運行,以在我的樹莓派的主顯示器上生成,同時在 Visual Studio 中仍然具有完整的調試控制(如斷點等)。 我不知道該怎么做。

預啟動命令屬性

我在其他教程中看到使用 Visual Studio 為 linux 編寫的調試 GUI 應用程序(例如,使用 GTK),在 C++ ZEDC9F0A5A5D57798BF368 項目的調試屬性頁面中找到的“預啟動命令”屬性可能是 73644 項目的關鍵這個。 在 GTK GUI 教程中,他們將命令export DISPLAY=:0.0放在此屬性中,以便調試模式下的 GUI 應用程序在樹莓派的主顯示屏上生成。 但是,這不適用於 TUI 應用程序。 因此,我希望我的問題的解決方案就像找到正確的論點來放入這個屬性一樣簡單。

我在這里指的 GUI 教程的鏈接是http://comfilewiki.co.kr/en/doku.php?id=comfilepi:create_a_linux_project:index#specify_the_include_pathties_in_the_project_s_proper

感謝任何幫助我的人。

RaspberryPi可以運行一些源自 Debian 的 Linux 分布,例如Raspbian

RaspberryPi 具有 wifi 和以太網。 您應該能夠將它們配置為通過sshd(8)通過 wifi 或通過以太網服務ssh(1)

一旦sshd服務器在您的 RaspBerryPi 上運行,您只需在 Linux 交叉開發機器上使用ssh在命令行上訪問它。

gdb調試器具有遠程調試功能,但您可以在通過 ssh 訪問的ssh上運行它

我一直在編寫一個 C++ TUI 應用程序,以使用 ncurses 庫在我的樹莓派終端中運行。

我有一個更簡單的建議:

在運行一些 Linux 發行版的筆記本電腦或台式機上調試 C++ TUI 應用程序。

僅在調試后為您的 RaspBerryPi 交叉編譯它。

大多數 C++ 應用程序都可以非常小心地編寫,以便輕松地從運行在 x86-64 筆記本電腦上的 Debian移植到運行在 RaspberryPi 上的 Raspbian。 請注意遵守 C++11(閱讀n3337 )或 C++17 標准。 使用最近的GCC編譯時啟用大多數警告,即使它是交叉編譯器。 因此,至少使用g++ -g -Wall -Wextra並改進您的 C++ 源代碼以盡量減少編譯器警告。

建議:在您的開發筆記本電腦或台式機上安裝一些 Linux 發行版。

為此,您只需要不到 100 GB 的連續可用磁盤空間。 UbuntuDebian都非常易於安裝,並且可以免費下載。

一旦 Linux 在您的筆記本電腦或台式機上運行,並且 Raspbian 在您的 RaspberryPi 上運行,您只需要連接它們,例如使用以太網電纜。

我建議在 Linux 筆記本電腦上的 Debian(或 Ubuntu)上安裝build-essentialcrossbuild-essential-arm64軟件包。 Also consider installing the git version control, the emacs editor (and/or geany and/or visual studio code ), the gdb debugger, the g++ compiler , the doxygen documentation generator, perhaps the Qt graphical toolkit, the ninja build automation tool, the GNU guile和/或Python和/或Lua和/或GNU awk腳本語言

不要忘記花幾天時間閱讀文檔。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM