admin管理员组

文章数量:1125557

I am using CMake and Mingw to build my (Qt) project in VSCode under Windows.
Within the build tree, a few more libraries are being built and linked.
And building works.

What does not work however, is actually running the application from the explorer, command line or VSCode, because the (previously linked) libraries are not being found in the execution context.

One possible solution is to create a launch.json, which adds the Qt folder as well as the respective build folders for the DLLs to the PATH environment variable upon launching.
This however is problematic, because, depending on the build, the (built) dlls may reside in a different path (i.e. release instead of debug). It's also not possible to just click 'run' or 'debug' (because neither would use the launch.json).

In QtCreator, I can automagically add the paths to the linked libraries to the PATH upon execution and I wonder if there's something similar in VSCode.

Alternatively, I'd also be happy to do something similar to what Linux seems to be doing.
When running ldd on the executable, all .so paths are being resolved correctly, even though they are not set in an environment variable, so I assume that there is some sort of 'hint' within the executable.

The solution only needs to work on the local machine, actual deployment ships the required DLLs in the same folder as the executable.

本文标签: cAutomatically add paths to linked libraries to VSCode executionStack Overflow