Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug error in VS Code

I tried to debug C++ file with gdb, but following error message is appeared.

Unable to 'main.cpp': File not found (file:///c/Users/.../main.cpp)

But I set the program path in launch.json file like this:

"program": "C:/Users/.../main.exe"

I think it's because VS Code recognizes C: to c, but I couldn't find any solutions to fix this issue.

How can I set target program's path correctly?

like image 645
EnDelt64 Avatar asked May 16 '26 18:05

EnDelt64


2 Answers

I found solution through asking VS Code GitHub. If above error message is appeared, add sourceFileMap to launch.json file.

"sourceFileMap": {
    "/c": "C:/"
}

https://github.com/Microsoft/vscode-cpptools/issues/1546#issuecomment-365368570

like image 162
EnDelt64 Avatar answered May 18 '26 08:05

EnDelt64


Try to write the path in the launch file as:

"program": "C:\\Users\\..\\main.exe"
like image 31
maetulj Avatar answered May 18 '26 07:05

maetulj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!