Error "The application was unable to start correctly (0xc0000142)" from the command prompt but not from Visual Studio

0

I have a project that I build with CMake, which is composed of a library black.dll and an executable black.exe that depends on the DLL. The DLL in turn depends on libz3.dll which is an external dependency.

When I build from the command prompt using CMake I cannot run the executable because of the error "The application was unable to start correctly (0xc0000142)". The external dependency libz3.dll is correctly copied into the executable directory.

But, when I build the project from Visual Studio 2019 (making it use CMake under the hood as well), everything works properly (when I copy libz3.dll into the executable directory).

I've looked at the two executables with Dependency Walker to understand what's the different between the two but there are no differences (both show errors of missing strange libraries such as API-MS-WIN-CRT-RUNTIME-L1-1-0.DLL but in the case of the executable built with VS it seems to not be a problem).

I've also checked to be building for the correct architecture: both the executable, the library and libz3.dll are built for x64.

What can I check to understand what's going on?

c++
windows
dll
cmake
asked on Stack Overflow May 24, 2021 by gigabytes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0