vs code with python: 1)click a button 2)enjoy. vs code with c++ 1) add configuration file 2) click on something that did not appear. 3) update something that did not even occur 4) frustration 5) sadness 6) there is no point in anything 7) become a farmer
Love VS Code, but this freedom comes at a cost. Some of the things I take for granted in an IDE can be a little bit of a headache, but I love in VS Code you can customize everything! Thank you for this video!
Love this video, it did absolutely nothing and not a single thing in the video worked the same in vscode. Making that intellij subscription seem really promising...
choose gdb launch and do this .. worked for me ---- paste this whole in the launch.json file ========================================== { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", // "miDebuggerPath": "C/C++ : g++", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }
Following the steps: I keep getting the following errors on Debug Console "Warning: Debuggee TargetArchitecture not detected, assuming x86_64. ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". Command 'exec-run'. Invalid process during debug session The program '/Users/maxwelljin/GitHub/practiceVSCode/CPP/Main' has exited with code 42 (0x0000002a)." what I am missing here?
there should be a way to debug while taking user inputs, while smaller inputs doesn't need a debugger tool bt it's impossible to hardcode huge inputs again and again.
how can I enable debugging when I am using miniconda for package dependencies? I find passing the following arguments in clion cmake argument works, but VSCode cannot allow me to do that: ``` -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS_DEBUG="-O0" -DCMAKE_CXX_FLAGS_DEBUG="-O0"```
Hi is it normal if i don't get any configuration when i try to debug ? like i'm doing everyting from the video but my launch.json is empty Thanks in advance and have a good one
What if I have a multiple-directory c++ program? I cannot compile it neither can debug it, but I have a makefile that works just fine. please help me anyone reading this comment, I am in immeasurable pain and my day is ruined.
in task.json, configure "args": [ "-g", "Program1.cpp", "main.cpp", "-o" "${fileDirName}\\${fileBasenameNoExtension}.exe"], since default is empty not eligible to link files and mostly end up with undefined reference error or cannot find .exe file. Hope this works
There is a problem I faced, "externalConsole": false, then I can't give input to the program at runtime, the debugging session, gets stuck on scanf() or cin and says that, they are running but it the terminal it don't take any input. So, It is necessary to "externalConsole": true, to be in the launch.jason file. Then it will open a new terminal and wait for you to give your inputs to the programs when necessary. SUGGESSTION: It would be very nice, if this things can be automated by the VSCODE
did you find a way to use the internal console of vsc for inputs? I'm struggiling with that and I'm thinking it might be related to lldb debugger but might be wrong.
@@talentotech-p1edont know but this happens with me when i use Windows(launch) config, as soon as i move to gdb launch the input works fine, through internal console.
Is it possible to change the formatting of the printed messages? All my output starts with @" and shows the new-line characters ... How can I just show the plain output?
change the line ending from LF to CRLF or plain text you can see in the video bottom right status bar the blue one it show line ending is set to LF change it.
Suppose I don't have the .cpp source file but only the binary "a.out", which is already running. Is there a way for me to monitor the variables and expressions after attaching the debugger to the a.out process?
you'd need the debug symbols to exist in the executable (GCC debug symbols added to compiler), and a GDB stub (Server) running in that app. Then GDB Client (say for ARM GCC: arm-none-eabi-gdb). Then connect through IP address & port from GDB Client into GDB stub. And then in the GDB stub implementation, you'd need a debug stack of sorts to extract the registers and paste them there. So GDB client could watch immediate register as variables and expressions real time.
Didn't get a response previously - how can I remove the @ characters and the newline characters from every print statement? Makes the formatting of all our logging completely illegible making debugging 10X harder!
It says that it was built succesfully but then it says "Unable to start debbuging. The value of miDebuugerPath is valid. What should I do? I did exactly what you did on the video.
if you're programming C++ games you don't need these at all. you'd only need them if you're coding emulators in baremetal hardware, which makes no sense at all since you should be using a debug unit on said units.
if you didnt install the debugger when installing the g++ compiler, then open the MSYS2 terminal and run the command pacman -S mingw-w64-x86_64-gdb to install gdb NOTE: path is not the same as compiler add "C:\msys64\mingw64\bin" to your local paths Follow the rest of the steps in the video and it should work
vs code with python: 1)click a button 2)enjoy.
vs code with c++ 1) add configuration file 2) click on something that did not appear. 3) update something that did not even occur 4) frustration 5) sadness 6) there is no point in anything 7) become a farmer
😂 bruh Im struggling with this mf for a while 😂
lol 😂
just wasted my whole day on this bs lmao
Love VS Code, but this freedom comes at a cost. Some of the things I take for granted in an IDE can be a little bit of a headache, but I love in VS Code you can customize everything! Thank you for this video!
The next step is setting up neovim, makes you appreciate the user friendliness of vscode ;D
Even Official microsoft is using OSX
I cannot see g++-7 at 0:37... how to solve that?
same happened to me.. did you discovered how to solve it?
this is years overdue 😂 I remember in my first year of uni thinking it was ridiculously more complicated to set up a build env in vscode than VS2017
Love this video, it did absolutely nothing and not a single thing in the video worked the same in vscode. Making that intellij subscription seem really promising...
It doesn't give me the option to choose a debugger environment. I can only choose between (gdb) Attach or (gdb) Launch configurations. Neither works.
choose gdb launch
and do this .. worked for me ----
paste this whole in the launch.json file
==========================================
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
// "miDebuggerPath": "C/C++ : g++",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
@@jigz3903 thanks dude how did you write this
@@kamalmohamed6611 😁 no problem
@@jigz3903 THANKS JIGZ i really appreciate it u just saved me an enormous headache
@@jigz3903 Your comment is hidden?!
Following the steps:
I keep getting the following errors on Debug Console "Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". Command 'exec-run'. Invalid process during debug session
The program '/Users/maxwelljin/GitHub/practiceVSCode/CPP/Main' has exited with code 42 (0x0000002a)."
what I am missing here?
Thank you soo much!
This tutorial was really helpful, now I love debugging and can understand how exactly the code is running.
there should be a way to debug while taking user inputs, while smaller inputs doesn't need a debugger tool bt it's impossible to hardcode huge inputs again and again.
cant we give input while debugging??
@@herohera3497 there is a way for sure. Just ask chat gpt
use a file to provide stdin
Doesn't match on windows
how can I enable debugging when I am using miniconda for package dependencies? I find passing the following arguments in clion cmake argument works, but VSCode cannot allow me to do that:
``` -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS_DEBUG="-O0" -DCMAKE_CXX_FLAGS_DEBUG="-O0"```
Hi is it normal if i don't get any configuration when i try to debug ? like i'm doing everyting from the video but my launch.json is empty
Thanks in advance and have a good one
did you ever find an answer to this? i have the same problem switching from vs to vs code
Sadly, auto-complete doesn't work on debug console. :/
"launch.json lives in your worspace directory's workspace folder"
No, it does not. I only have settings.json and tasks.json.
this is so frustrating
Did u solve it
This is one of the best videos I've seen on this but alas it still won't work on my install lol back to code blocks
What if I have a multiple-directory c++ program?
I cannot compile it neither can debug it, but I have a makefile that works just fine. please help me anyone reading this comment, I am in immeasurable pain and my day is ruined.
I keep getting : launch program does not exist debug, using linux redhat, and gcc as compiler
in task.json, configure "args": [ "-g", "Program1.cpp", "main.cpp", "-o" "${fileDirName}\\${fileBasenameNoExtension}.exe"], since default is empty not eligible to link files and mostly end up with undefined reference error or cannot find .exe file. Hope this works
is it possible to attach to running processes in vs code?
those arent there for me anymore. After i installed the jdk i cant find any c++ debuggers
It's not working for me.
Loved how integratedconsole error is being hidden in this presentation 😂
There is a problem I faced,
"externalConsole": false, then I can't give input to the program at runtime, the debugging session, gets stuck on scanf() or cin and says that, they are running but it the terminal it don't take any input.
So, It is necessary to "externalConsole": true, to be in the launch.jason file. Then it will open a new terminal and wait for you to give your inputs to the programs when necessary.
SUGGESSTION: It would be very nice, if this things can be automated by the VSCODE
did you find a way to use the internal console of vsc for inputs? I'm struggiling with that and I'm thinking it might be related to lldb debugger but might be wrong.
@@talentotech-p1edont know but this happens with me when i use Windows(launch) config, as soon as i move to gdb launch the input works fine, through internal console.
I installed gdb and gcc on my MACOS, I do these steps and I can't debug. What do I do?
Is it possible to change the formatting of the printed messages? All my output starts with @" and shows the new-line characters
... How can I just show the plain output?
change the line ending from LF to CRLF or plain text
you can see in the video bottom right status bar the blue one it show line ending is set to LF change it.
What if we want to input a value using cin? we can't write anything in debug console
Suppose I don't have the .cpp source file but only the binary "a.out", which is already running. Is there a way for me to monitor the variables and expressions after attaching the debugger to the a.out process?
you'd need the debug symbols to exist in the executable (GCC debug symbols added to compiler), and a GDB stub (Server) running in that app.
Then GDB Client (say for ARM GCC: arm-none-eabi-gdb). Then connect through IP address & port from GDB Client into GDB stub.
And then in the GDB stub implementation, you'd need a debug stack of sorts to extract the registers and paste them there. So GDB client could watch immediate register as variables and expressions real time.
How do I input variable values during debugging mode?
Didn't get a response previously - how can I remove the @ characters and the newline characters from every print statement? Makes the formatting of all our logging completely illegible making debugging 10X harder!
change your line ending to CRLF
hi your steps work fine but i need to reconfigure each time !!! yes each time why please answer me 🙏🙏
There is no selection of debugger environment. These setup instructions are obsolete. Does anyone have an updated one?
Did you find a workaround?
It says that it was built succesfully but then it says "Unable to start debbuging. The value of miDebuugerPath is valid. What should I do? I did exactly what you did on the video.
set miDebuggerPath to exact path where your gdb.exe is present
My debugger starts and turns off after on its own
How to do this on Linux
I love how this tutorial straight up doesn't work in 2024. They already broke half the stuff in here
but this would be inferior to debugger offered by MSVC isnt it?
Where is the memory view and register view? Not a very good tool for serious debugging.
if you're programming C++ games you don't need these at all.
you'd only need them if you're coding emulators in baremetal hardware, which makes no sense at all since you should be using a debug unit on said units.
Will you make a video in which we could make a normal game in visual studio code c++
if you didnt install the debugger when installing the g++ compiler, then open the MSYS2 terminal and run the command
pacman -S mingw-w64-x86_64-gdb
to install gdb
NOTE: path is not the same as compiler add "C:\msys64\mingw64\bin" to your local paths
Follow the rest of the steps in the video and it should work
Why to make a tutorial on a microsft software, microsoft uses a mac? 😕
This was helpful, thanks:)
Very helpful, thank you much!
there is no input console
just set externalconsole =true it works fine now
how to show string debugging, i use WinOS
Sir can you please solve this error in vs code "this language server has crashed 5 times in 3 minutes. It can be restarted." Fix it
Not them using an Apple's OS. >_
microsoft product using in a apple product
love it, super simple
ok, so microsoft uses mac OS...
Нечем не помогла...
visual studio code is bullshit, It is literally impossible to nnot get an error
Visual Studio Code sucks big time.