0

So I have this problem. I am currently trying to create an app where a user can enter a nametag before using it. Let's say I have a main.cpp file in which I call func1.cpp and func2.cpp files. I have included a few heades files that I will list below. I compiled main.cpp into an executable file and it worked just fine on my machine. But when I tried to share it with someone, it said it was missing a few ddl. I tried putting the missing ddl in the same foler of my executable but now they get the error 0xc000007b

Here are the header files included : main.cpp :

#include <windows.h>
#include <winuser.h>
#include <string>
#include <iostream>
#include "func1.cpp"
#include "func2.cpp"

func1.cpp :

#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <filesystem>
#include <unistd.h>

func2.cpp :

#include <string>
#include <fstream>
#include <filesystem>
#include <unistd.h>

The missing dll were :

  • libgcc_s_seh-1.dll
  • libstdc++-6.dll
  • libwinpthread-1.dll

Does soemone know how to fix error 0xc000007b ? I heard that statically linking the required ddl to my executable file might solve the problem, although I don't have a single clue on how to do that. Or maybe it is because I included func1.cpp and func2.cpp as .cpp files and not .h files ?

I used Visual Studio Code 2019 and MSYS2 as a compiler. Please someone help me I have been struggling on this for litteral days

I also tried using

#if COMPILING_DLL
    #define DLLEXPORT __declspec(dllexport)
#else
    #define DLLEXPORT __declspec(dllimport)
#endif

but failed.

  • ***I heard that statically linking the required ddl to my executable file might solve the problem*** No that won't remove the requirement. Instead do what most commercial software does. Use an Installer program like NSIS or WIX that will package all the required dlls into one program that is run to properly install on the target machine. [https://nsis.sourceforge.io/Download](https://nsis.sourceforge.io/Download) [https://wixtoolset.org/](https://wixtoolset.org/) – drescherjm Feb 18 '23 at 01:28
  • 2
    Not related to your problem but including one cpp file in another is an error, and (frankly) shows you don't know much about how to build C++ programs. Static linking might solve your problem, but you statically link **libraries** not DLLs. Statically linking a DLL is a contradiction in terms. So if you have static library versions of the DLLs you are currently using this might solve the problem, but I have no idea if that is the case and neither would I know how to do that with the compiler you are using. Read the documentation. – john Feb 18 '23 at 06:15

0 Answers0