Can't find entry point (_ZSt28__throw_bad_array_new_lengthv) in DLL (filepath)
Asked Answered
T

2

6

The error

The exact error is the title of the question. A picture of the error.

It happens when I use vectorName.push_back() function. I recreated it with just this simple code:

#include <iostream>
#include <vector>

using namespace std;

int main() {
    vector <int> vec = {};
    vec.push_back(2);
    return 0;
}

Compiler and setup information

I'm using msys2, and I set it up using this guide

I have no idea if this is relevant or not, but I used tdm-gcc before this.

Research

A fix is almost nowhere to be found, or I just didn't look hard enough. I have found some posts about the _ZSt28__throw_bad_array_new_lengthv, but not with entry point. And because I didn't find anything about this exact issue, I didn't try anything.

Tetrachloride answered 8/12, 2022 at 17:58 Comment(6)
Do you get this error when you build your program, or when you run your program?Ctenoid
After a quick search it seems to be because a possible mismatch between the GCC compiler version installed, and the GCC standard C++ installation. What version of GCC do you have installed? Have you tried to install different versions of GCC?Ctenoid
Move C:\msys64\mingw64\bin to the top of the PATH. If this doesn't help, build with -static or copy the DLLs your program uses next to the .exe (ntldd -R 123.exe to get the list of dlls, ignore those not present in C:\msys64\mingw64\bin).Muggins
It happened when I ran the program that was compiled. The version is 12.2.0. The build doesn't give out any errors. I went back to tdm-gcc because that still works.Tetrachloride
Since I can't reproduce this in the MSYS2 shell, I would guess this is an issue with your VSCode environment. What happens if you run g++ -Wall test.cpp && ./a.exe to compile and run your code in MSYS2's MinGW 64-bit shell? What is the output of which g++?Radix
@DavidGrayson I'd guess it runs without an error in the msys2 shell, but not when double-clicked it in Windows explorer.Maneating
T
8

Problem: "the procedure entry point _zst28__throw_bad could not be located in the dynamic link library"

(with msys2 mingw64)

Solution: Modify the system environment variables (requires admin rights)

Start the windows commandline (cmd.exe) as admin (right-click run as administrator). Then enter this command:

"C:\Windows\system32\rundll32.exe" sysdm.cpl,EditEnvironmentVariables

Then edit the PATH at the bottom (under Systemvariables), and make sure that C:\msys64\mingw64\bin is right at the top position.

Done.

Check as follows in cmd:

echo %PATH%

You can also non-persistenly edit the PATH from a cmd as follows (also does not require admin rights):

set PATH=C:\msys64\mingw64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Tolerance answered 21/2, 2023 at 12:54 Comment(1)
In most cases, you expand PATH instead of replacing it completely.Maneating
M
3

i also found problem like this, on windows 10 use msys2. when i try to build minimal.cpp example with cmake, build process is work and complete without error:

enter image description here

But when i try to run program the error say "entry point not found", after searching what really wrong for several day, i found copying libstdc++-6.dll on same folder with program, make program working as expected.

error window screenshot (click for image)

enter image description here

(Hopefully its help somebody in future)

Mitzvah answered 23/6, 2023 at 16:41 Comment(1)
Exactly this helped fix the error when I run my (“statically”) linked minimal wxWidgets app. The file libstdc++-6.dll can be found in `C:\msys64\mingw64\bin`.Maneating

© 2022 - 2024 — McMap. All rights reserved.