2

VSCode is displaying the error message

ERROR: During startup program exited with code 0xc0000135.

When I try to debug the code. Initially MinGW installation was showing the error missing dll files, then I reinstalled MinGW, now it is no more showing any errors and the catalogue is updating properly. Restarted the system, re-added the bin folder to the Environment Path Variable.

The file is being compiled and executing properly, the Error message is displayed only while debugging

IDE: VSCode

Compiler: MinGW

OS: Windows

Tried Fixes:

  • Reinstalled MinGW
  • Added the bin folder to the environment path variables
  • Restarted VSCode

launch.json for VSCode:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\C++\\minGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}

Code:

#include <iostream>

int main(){
    std::cout << "Hello World" << std::endl;
}
scarecrow
  • 57
  • 2
  • 8
  • 3
    `0xc0000135` is dll not found. Maybe `D:\\C++\\minGW\\bin` is not in your OS path environment variable. This Microsoft help page describes how and where your OS will look for dlls: [https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications](https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications) – drescherjm May 26 '22 at 18:48
  • You're still missing one or more DLLs required by the debugger. Darned if I know which or why. – user4581301 May 26 '22 at 18:48
  • It is my OS Path Environment Variable @drescherjm , it was the same before the debugger started showing errors. – scarecrow May 26 '22 at 18:50
  • Maybe there is some problem with your mingw. You may want to just install msys2 and have it install mingw: [https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2](https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2) VSCode recommends that anyways: [https://code.visualstudio.com/docs/cpp/config-mingw](https://code.visualstudio.com/docs/cpp/config-mingw) – drescherjm May 26 '22 at 18:54
  • You also could try running your program in a cmd.exe window and see if it works there and make sure that the path is correctly set there. My alternate guesses involve turning off the antivirus (perhaps your AV blocked or deleted one or more of your mingw dlls) and making sure you are not mixing 32 and 64 bit. I would expect a different error code for the latter however. – drescherjm May 26 '22 at 19:10
  • This program can help you look at it by analyzing the dependent dlls: [https://github.com/lucasg/Dependencies](https://github.com/lucasg/Dependencies) – drescherjm May 26 '22 at 19:14
  • Also you may want to make sure that there are no other versions of mingw or gdb on your PC. – drescherjm May 26 '22 at 19:19
  • Installed msys2 and installed minGW through it, debugging works perfectly fine now thanks for that advice @drescherjm , also I usually disable my antivirus before debugging, there are no other versions of mingw or gdb on my pc. Is mingw optimal or should I switch to cygwin? – scarecrow May 26 '22 at 20:15
  • 1
    I think msys2 offers the best mingw / gcc experience on windows. However with that said I primarily use msvc at work. I test msys2 + mingw mostly just to help users on StackOverflow. – drescherjm May 26 '22 at 20:38

1 Answers1

1

I just encountered exactly the same problem with the Qt Creator debugger (which is why I came here looking for help). Here is what I did to get it running in the debugger:

  1. Run the program from the command line after deleting PATH (with "PATH="). This won't work -- that is intentional.
  2. Note the first missing DLL that it complains about. In my case this was pthreadGC-3.dll.
  3. Restore PATH, and find out where that dll is located with "where pthreadGC-3.dll").
  4. Copy that dll to the same directory as the executable program.
  5. Try and debug the program.

This worked for me. If it works for you, you can either leave that DLL where it is, which is a bit untidy, or you can put its directory into your global path. If it doesn't work, you might try repeating steps 2-5 with a different DLL.

TonyK
  • 16,761
  • 4
  • 37
  • 72