I'm a new apprentice at my company, so I'm new to Stackoverflow and coding in general, please bear with me.
I wanted to get away from the text editors (gedit and geany) I used before and started looking for an IDE. I chose to use Visual Studio Code, and started setting it up. I had to set up a compiler and a debugger. The compiler worked, but the debugger is making trouble.
I am running Debian 64 bit in a virtual machine, the host system is windows 10 64 bit. This is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "/usr/bin/gdb",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
},
{
"name": "C++ Attach",
"type": "cppdbg",
"request": "attach",
"program": "/usr/bin/gdb",
"processId": "${command.pickProcess}",
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
}
]
}
As you can see, I set the program to gdb. Now if i try to debug my code with "C++ Launch" the terminal window for the gdb debugger will open, and the VSCode window looks like it is in debug mode.
Shortly before my Virtual machine crashes
Then my Virtual Machine just crashes, without any error message. My virtual machine client says canceled. I looked into every logfile that seemed at least a little relevant. I checked the virtual machine log. I google this problem in various ways. I checked if it crashes even if I close gdb before the crash (it does). And still I haven't found a way to prevent this crash from happening.
I asked most of my co-workers and they don't know an answer either.
This is my first post/question, if I made any mistakes (format, formulation, etc.) please tell me, so the next time I want to ask something it will be better.
Thanks in advance.
Related
I'm using zsh from vscode integrated terminal
i also use hyper terminal, warp and iterm2 for other purposes but i like to use the integreated terminal while in vscode. i actually enjoy my heavy .zshrc config on external terminals, but i often get the popup "your shell environment is taking too long to load" from vscode. Tbh, i don't mind the popup itself, but i think that a lot of the features that are useful outside vscode are not needed inside.
How can i set a different .zshrc to load only to be used by the vscode integreated terminal ?
tried conditional loading from my .zshrc but don't like it
tried setting it in the vscode-settings.json
this self-answer confused me more
this i think points in the right direction but i am not sure how to use task.json
my env:
macOS 13.1 22C65 arm64
Apple M1 Max
vscode (1.74.11ad8d514439d5077d2b0b7ee64d2ce82a9308e5a for arm64)
zsh 5.9 (arm-apple-darwin22.1.0)
These are the settings to change in “settings.json”:
I created 3 profiles:
zsh-minimal with the vscode minimal config -> new ZDOTDIR
zsh-full with my usual heavy config -> probably not necessary since it is $HOME by default i think
bash, just in case i fu everything
set to null old profiles ( zsh and zsh(2)) to delete them from profiles selection dropdown menu, as per official documentation.
“terminal.integrated.defaultProfile.osx”: “zsh-minimal”,
“terminal.integrated.profiles.osx”: {
"zsh-minimal": {
"title": "zsh-minimal",
"path": "/opt/homebrew/bin//zsh",
"icon": "terminal",
"color": "terminal.ansiMagenta",
"args": [
"-l",
"-i"
],
"cwd": "${workspaceFolder}",
"env": {
"ZDOTDIR": "/Users/MYUSERNAME/.homesick/repos/MYUSERNAME-dotfiles/home/vscode_zsh"
},
},
"zsh-full": {
"title": "zsh-full",
"path": "/opt/homebrew/bin//zsh",
"icon": "terminal",
"color": "terminal.ansiCyan",
"args": [
"-l",
"-i"
],
"cwd": "${workspaceFolder}",
"env": {
"ZDOTDIR": "/Users/MYUSERNAME/"
},
},
"bash": {
"title": "bash",
"path": "/bin/bash",
"icon": "terminal",
"color": "terminal.ansiWhite",
"args": [
"-l",
"-i"
],
"cwd": "${workspaceFolder}",
},
"zsh": null,
"zsh (2)": null,
}
I just have a quick question:
EDIT: This is run under Ubuntu 20.04 WSL2 using Visual Studio Code.
So I am debugging a kernel for gdb and the symbol files require that GDB is launched in the project directory, but the problem is GDB keep launching in the location of the program:
-exec pwd
Working directory /home/user/project-directory/obj/kern
I need GDB to stay in the project-directory:/home/user/project-directory
In the VSCode launch.json file, I made a workaround by adding a custom launch setup as shown below:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Kernel",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/obj/kern/kernel",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"printCalls": true,
"showDevDebugOutput": true,
"setupCommands": [
{
"description": "Change back to the workspace folder",
"text": "cd ${workspaceRoot}",
"ignoreFailures": true
},
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
// "preLaunchTask": "Launch Qemu (no graphic)",
"miDebuggerPath": "/usr/bin/gdb",
"miDebuggerArgs": "",
"targetArchitecture": "x86_64",
"customLaunchSetupCommands": [
{
"text": "target remote localhost:1234",
"description": "Connect to QEMU remote debugger"
},
{
"text": "symbol-file obj/kern/kernel",
"description": "Get kernel symbols"
},
// {
// "text": "set architecture i8086",
// "description": "Sets the current architecture"
// }
],
"avoidWindowsConsoleRedirection": true
}
]
}
The ${workspaceFolder} and ${workspaceRoot} are located in the project's directory, but without the setup to change back into the workspace folder, it won't work. Any tips would be appreciated!
I have configured my task.json and c_cpp_properties.json so that I may compile my main.cpp program. In order to proceed, I must press
Ctrl + Shift + B
As soon as I do a terminal pops up and alters me of an error:
Executing task in folder C++: C:\MinGW\bin\g++.exe -g main.cpp -o c:\Users\Me\Desktop\C++\.vscode\tasks.exe <
/bin/bash: C:MinGWbing++.exe: command not found
The terminal process terminated with exit code: 127
Terminal will be reused by tasks, press any key to close it.
I don't why this is happening since I've already checked that MinGW is installed in my computer with the correct PATH. To ensure that I do I typed the following in the terminal:
g++ --version
g++ (MinGW.org GCC-8.2.0-3) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
I also checked the path according to this figure
The only closest problem related to mine is in this Github link. I've also already tried changing the file directory shown in the code below using this thread but I still encounter this error.
Here are my JSON files which are inside my .vscode file:
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"main.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
I should expect to see a ".exe" after compiling but I can't due to the error.
After spending two days messing around with this I've finally able to correct setup C++ on VS Code and resolved the error.
According to the png image from above, I've included "C:\MinGW\bin" within the user variable "Path" under the dialogue box "User variables for Me". After a simple restart on my computer, I was able to build my project (Shift + Ctrl + B) with no problems.
I've been trying to follow a tutorial on building your first action for google home:
https://medium.com/google-cloud/building-your-first-action-for-google-home-in-30-minutes-ec6c65b7bd32
I was able to deploy my application to the google cloud, but once I try to deploy my action.json test file I receive an error message that says: "No help topic for 'preview'."
./gactions preview --action_package action.json --invocation_name "three doors" --preview_mins 1234
No help topic for 'preview'
I've followed the suggestions from:
https://stackoverflow.com/questions/46591266/golang-runtime-panic-when-using-gaction-on-linux-to-update-google-home-assistant
But updating gactions didn't work either as there were no new updates.
I'm running ubuntu-18.04.2 Linux 4.18.0-15-generic x86_64
{
"versionLabel": "1.0",
"agentInfo": {
"languageCode": "en-US",
"projectId": "three-doors-3124",
"voiceName": "male_1"
},
"actions": [
{
"description": "Launch intent",
"initialTrigger": {
"intent": "assistant.intent.action.MAIN"
},
"httpExecution": {
"url": "https://us-central1-three-doors-3124.cloudfunctions.net/three_doors"
}
}
],
"locale": "en"
}
I'm not sure how to fix this problem, so any help would be much appreciated.
Thanks
That post is from 2017, and a lot of the development environment and setup has changed since then. I'd recommend going to the codelabs as they will provide good up to date starting guides.
Is there a way I can modify tasks.json and keybingings to create shortcuts for compiling the code and running it?
After a ton of googling I came up with this. When I press ctrl+shift+b it compiles but command prompt with the program doesn't pop up.
"version": "0.1.0",
"isShellCommand": true,
"showOutput": "always",
"command": "cmd",
"args": ["/C"],
"tasks": [
{
"taskName": "Compile",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["\"fpc ${file}\""]
},
{
"taskName": "Run",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["\"start $[fileBasenameNoExtension}.exe\""]
}
]
}
Pascal is stil alive and kicking. What I meant by Pascal is the modern object Pascal programming, not your daddy's Pascal. I've been making many apps for all platforms using (mainly) Free Pascal, with Lazarus IDE (for GUI apps) and VS Code (for non-GUI apps). Modern Pascal can do whatever every other languages out there are able to do. Check out The Big 5 Pascal of Today.
Now… to be able to work use Pascal with VS Code. First, install Free Pascal for sure. Then install the OmniPascal extension. And read my guide Free Pascal and VS Code. I provide many useful tasks in there to help you work with Pascal, including code formatting. It's in Indonesian but you could use Google Translate to read it in English (or whatever language you like).
HTH.
this is my tasks.json and it works very well
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "PAS build active file",
"command": "fpc",
"args": [
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}