Vscode-cpptools: Cannot debug C++ codes with string variables defined

Created on 14 Nov 2017  Â·  5Comments  Â·  Source: microsoft/vscode-cpptools

  • OS: Windows 10, Version 1703
  • VS Code version: 1.18.0 no Insiders build
  • C/C++ extension version: 0.14.2
  • Other extensions:

Extension name | Author | Version
------------------ | --------- | --------
ESLint | Dirk Baeumer | 1.4.3
Python | Microsoft | 0.8.0

I find this issue when I define some C++ string variables in my code cpp_string.cpp below:

#include <iostream>
#include <string>

using namespace std;

int main()
{
    ...
    string str1, str2, str3, temp;
    ...
}

the debug did not start but the debug console showed

ERROR: During startup program exited with code 0xc0000139.
The program 'd:\C++\cpp_string\cpp_string.exe' has exited with code 0 (0x00000000).

image

And if I code C++ without defining any string variables, even I #include<string> the debug will start and no ERROR message in debug console.

Source and relevant JSON files are in .zip attachment.
attachment.zip

debugger external

Most helpful comment

I updated my MinGW to 7.2.0 and the problem fixed. Thanks.

All 5 comments

@ComradeZeil Can you provide the full build number for your Windows Build? Also what are you using to compile? I see you are using MinGW gdb.exe to debug, are you compiling with gcc.exe? Can you provide the version of MinGW you are trying to use? Does the program run itself from the command line?

this sounds like a compilation problem and not a debugging problem.

  • Windows Build: 15063.726
  • Compiler: MinGW g++ 6.3.0

From command line the program prompts

The procedure entry point
_ZNKSt7__cxx1112basic_stringlcSt11char_traitslcESalcEE7compareERKS4_
could not be located in the dynamic link library D:\C++\cpp_string\cpp_string.exe.

image

@ComradeZeil This doesn't sound like an issue with the extension. That sounds like a problem with the version of MinGW that you have. I verified that the one I have is MinGW g++ version 7.1.0 and I can't repro what you have. You may want to update the version of MinGW.

I updated my MinGW to 7.2.0 and the problem fixed. Thanks.

Was this page helpful?
0 / 5 - 0 ratings