Installing And Configuring VCode Linux - iat-cener/tonatiuh GitHub Wiki
Installing and Configuring Visual Studio Code on Linux
Visual Studio Code (VSCode) is a free, open-source code editor developed by Microsoft. It offers powerful features such as debugging, syntax highlighting, Git integration, intelligent code completion, and extensions for virtually every programming language.
This guide explains how to install and configure VSCode on Linux-based systems.
Install via .deb Package (Debian/Ubuntu)
- Download the latest .deb from the official website.
- Open a shell and go to downlaod path.
- Install it using:
sudo apt install ./code_*.deb
The installation process will take some seconds.
- Verify the installation lauching the VSCode from a terminal:
code
- Install additional components to enable C++ development and git integration. Go to the Extensions view and select the following:
- C/C++ Extension Pack
- Git Extension Pack
Download Tonatiuh code from the repository
To start developing on Tonatiuh source code:
- Go to Source Control view
images/developersguide/windows/VSSourceCodeView.jpg |
---|
Figure 1. View of the Visual Code Source Control view. |
- Click on "Clone Repository" button.
- In the command pallete, enter the URL of the repository:"https://github.com/iat-cener/tonatiuh.git"
images/developersguide/windows/VSSourceClone.jpg |
---|
Figure 2. View of the Visual Code with the URL definted to clone the repository. |
- Choose a local directory to clone the repository into your computer.
- Open just cloned repository in VS Code.
Configure to compile and run using MSYS2 and MinGW system
By default, VS Code is not configured to use MinGW compiler. For this reason, it is required to create manually some task tp enable building and debugging within the IDE. Additional task are also required to lauch Tonatiuh application from the IDE:
- Go to the "Run and Debug" view.
- Click on "create a launch.json file".
- On the command pallete it is required to select the debugger. Select "C++ (GDB)" as debuger.
- If it is not listed, open the command palette (Ctrl+Shift+P), search "C/C++: Change Configuration Provider..." and select (none)" to disable active configuration (tipycally MCVS). Then, repeat "create a launch.json file" steps.
- This action will create a ".vscode" folder with "launch.json" file. Replace its contents with the following configuretion to run Tonatiuh in debug mode (modify paths as needed):
{
"version": "0.2.0",
"configurations": [
{
"name": "Tonatiuh Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/TonatiuhProject/bin/debug/Tonatiuh",
"args": [],
"cwd": "${workspaceFolder}/TonatiuhProject/bin/debug",
"environment": [
{
"name": "LD_LIBRARY_PATH",
"value": "${env:PATH};${workspaceFolder}/TonatiuhProject/bin/debug/"
},
],
"stopAtEntry": false,
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe"
}
]
}
- Create a new file named "tasks.json" inside ".vscode" folder to define the build task for compile and execute Tonatiuh. Open this file and complete it to configure to run Tonatiuh in debug mode:
{
"version": "2.0.0",
"tasks": [
{
"label": "qmake",
"type": "shell",
"command": "qmake TonatiuhProject.pro",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject", },
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "make all",
"type": "shell",
"command": "make all",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject",
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "Tonatiuh Release",
"type": "shell",
"command": "${workspaceFolder}/TonatiuhProject/bin/release/Tonatiuh",
"group": {
"kind": "test",
"isDefault": true
},
"options": {
"env": {
"LD_LIBRARY_PATH": "${env:PATH};${workspaceFolder}/TonatiuhProject/bin/release/"
}
}
}
]
}
Building Tonatiuh
After configuring VSCode to work with Tonatiuh code, it is ready to begin with building process.
- Go to "Terminal" menu and select _"Run Task...".
- In the list select "qmake" task. The Makefiles files generation process will start.
- Once it finishes, select "make all" task to compile the code. This will take several minutes.
- To run Tonatiuh in release mode, select ""Tonatiuh Release" task. The GUI of the application will be shown.