Unable to open source file outside workspaceFolder from project outline
See original GitHub issuehi @bobbrow, I am using 1.4.2 CMake Tools on macOS, but the issue is still there:
Unable to open 'main.cpp': Unable to read file '/Users/admin/Projects/A/console/Users/admin/Projects/A/src/main.cpp' (Error: Unable to resolve non-existing file '/Users/admin/Projects/A/console/Users/admin/Projects/A/src/main.cpp').
The project structure looks like:
A $ tree -L 2 .
.
├── README.md
├── console
│ ├── build
│ └── CMakeLists.txt
├── src
│ └── main.cpp
└── third-party
with this simple setup:
set(MAIN_SOURCE_DIR "../src")
file(GLOB_RECURSE CPP_HEADERS ${MAIN_SOURCE_DIR}/*.hpp)
file(GLOB_RECURSE CPP_SOURCES ${MAIN_SOURCE_DIR}/*.cpp)
add_executable(
A
${CPP_HEADERS}
${CPP_SOURCES}
)
As you can see, the error reports a path with <CMakeLists Dir>+<Absolute Source Path>, which is duplicate and totally wrong.
'/Users/admin/Projects/A/console/Users/admin/Projects/A/src/main.cpp'
Platform and Versions Operating System:macOS CMake Version:3.18.4 VSCode Version:1.50.1 CMake Tools Extension Version: 1.4.2 Compiler/Toolchain: Clang 11
_Originally posted by @mutoo in https://github.com/microsoft/vscode-cmake-tools/issues/1254#issuecomment-713215418_
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Debugging unable to open source files - Stack Overflow
So, debugger cann't open the source file, because it looks into /proc/self/cwd/external folder which doesn't exists.
Read more >Debug Node.js Apps using Visual Studio Code
Setting up a project for Node.js debugging is straightforward with VS Code providing appropriate launch configuration defaults and snippets.
Read more >How to manually configure Visual Studio Code for Debugging ...
Open Folder in Visual Studio Code and write a C++ program ... In the main VS Code editor, click on File -> New...
Read more >Project Import and Build errors in CCS
Explains how to fix Code Composer Studio (CCS) project import errors and build errors and ... Error: could not open source file "xxx.h"....
Read more >Opening source files in Visual Studio Code - Microsoft Learn
If you work on a local project and you have Microsoft Visual Studio Code installed, you can open files in this one instead...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@sleiner, your contribution is in 👍. If all goes according to plans, we should release CMake Tools 1.7.2 tomorrow. Until then, here’s a vsix with your change, if needed: https://github.com/microsoft/vscode-cmake-tools/actions/runs/814930130.
Hi everyone, I have the exact same issue than @bobbrow (EDIT: sorry, it was @mutoo).
If I don’t make any mistake, we are following a tutorial to create a sort of graphic engine on multiple platforms, using C++ and SDL: https://marcelbraghetto.github.io/a-simple-triangle/2019/03/02/part-02/
In this part, the author shows how to configure it’s own VSCode instance using Cmake and Cmake Tools (vector-of-bool version, not from microsoft), but following the steps VSCode + extensions does not follow the rules and create another full path inside the current workspace folder.
I expect that the configuration of the extensions change, or something we missed, because using the scripts on the console directly works, check the code directly and build the binary.
Setup: