'VSCode + MSVC: Unable to open 'throw.cpp' (or exe_common.inl): File not found
I am using MSVC+VSCode to compile C++ Program with cl+nmake for comparable operations on gcc+make. The build with nmake seems okay after some trouble with tasks.json, c_cpp_properties.json, etc. But I encountered problems during debugging, which may involves setup of launch.json around "sourceFileMap", but I'm not sure what to do with it properly.
If the program is bug-free, upon exiting it pops Unable to open 'exe_common.inl': File not found and if clicking Create File it creates an empty file at {Disk}/a01/..., a strange directory. If encounters a bug and throw an exception, it pops Unable to open 'throw.cpp': File not found and does the same. I suppose it wants to locate the files under ...\VC\Tools\MSVC\14.29.30133\crt\src\vcruntime since I could find the files VSCode mentions, but don't know how to address it. I haven't found the very similar posts addressing the solution. How could I get it resolved?
# launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "nmake build and debug active file",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "nmake build active file"
}
]
}
# tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "nmake build active file",
"command": ".vscode\\build.bat",//build.bat invokes the Developer Command Prompt and run cl.exe,
"args": [
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: cl.exe"
}
]
}
# c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x86-windows/include"
],
"browse": {},
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "%PROGRAMFILES(X86)%/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
