EnDelt64
EnDelt64

Reputation: 1360

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?

Upvotes: 3

Views: 5019

Answers (2)

EnDelt64
EnDelt64

Reputation: 1360

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

Upvotes: 4

maetulj
maetulj

Reputation: 1042

Try to write the path in the launch file as:

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

Upvotes: 1

Related Questions