-1

I am compiling a C++ program on windows under MSYS2 MinGW and I am using the libpqxx library, the program compiles fine but when I go to run it from file explorer I get the following error

The Procedure entry pointstd::from_chars(char const*, char const*, double&, std::chars_format) could not be located in the dynamic link library libpqxx-7-7.dll

Image Here

this program runs without any errors if I run it from the MSYS2 MinGW terminal (By executing ./main.exe) but I would like the program to work without having to install MSYS2. I have the libpqxx library installed. I am using the following commands to compile the program

g++ main.cpp -o main libpq.lib -lpqxx

pkg-config --cflags --libs gtk+-3.0

(this program was developed on linux and I am using the gtk library)

(edit) Here is the folder structure that I have, the required dll is contained in the folder already, if I remove the dll then I get a file not found error

folder Structure

any help would be greatly appreciated

Austin
  • 1
  • 2
  • Copy the dll from the MSYS2 folder and place it next to the .exe. It's not the only dll you'll need to copy to distribute your program to others. – HolyBlackCat Jul 11 '22 at 03:45
  • @HolyBlackCat forgot to mention that the folder that my program is being run from already contains the libpqxx-7-7.dll file, I have added a picture to the question that has my folder structure – Austin Jul 11 '22 at 05:56
  • Then it's the wrong dll. Or, another thing that's suspicious is your use of `libpq.lib`. MinGW uses .a, not .lib. The latter is used by MSVC, and dlls from the two are normally incompatible. – HolyBlackCat Jul 11 '22 at 06:20
  • @HolyBlackCat the libpqxx-7-7.dll that is in the folder was copied from the msys64 folder. Should I try to compile with libpq.a instead? – Austin Jul 11 '22 at 06:28
  • Hmm, then the dll is ok. But I'm unsure where the .lib came from. – HolyBlackCat Jul 11 '22 at 07:22
  • Normally you link either .a (static linking) or .dll.a (to later load the dll at runtime). – HolyBlackCat Jul 11 '22 at 10:49

1 Answers1

0

I have fixed the problem, I just needed to add a few more dll files to the directory in which my program resides and now it starts!

the dll files required are:

libintl-8.dll
libstdc++-6.dll

these dll files can be found in the bin folder under the mingw64 folder

Thanks to @HolyBlackCat for pointing me in the right direction (telling me that I need more dlls)

Austin
  • 1
  • 2