0

I'm a newbie so please forgive me my primitive developer language :)

I´m trying to compile a C++ program in Visual Studio Code and it works fine for me, but when i try to run the exe file on different computer I'm getting error, that I'm missing libgcc_s_seh-1.dll and libstdc++-6.dll. I was able to solve this problem by adding '-static-libgcc' and '-static-libstdc++' flag to my compile command, but now I'm getting two more errors from missing 'libgomp-1.dll' and 'libwindthread-1.dll' and I was not able to solve this on my own. If I understand it I should have these dlls on my computer, because it's working on my computer, but I can't for some reason link them to compile together with my program This is my compile command: g++ -fdiagnostics-color=always -fopenmp -static-libgcc -static-libstdc++ -g -std=c++20 C:\Users\PC\Documents\DP\code\*.cpp -o C:\Users\PC\Documents\DP\code\MDSR.exe

So now my problem is the error saying I'm missing 'libgomp-1.dll' and 'libwindthread-1.dll'.

  • 2
    ***that I'm missing libgcc_s_seh-1.dll and libstdc++-6.dll*** Those should be in your `MinGW\bin` folder and easy to put in the same folder as your executable or just add that folder to your PATH environment variable. Also instead of trying to statically link your runtime you may want to package your software in an installer (like most commercial software does). At work I have used NSIS since 2008 with great success. [https://nsis.sourceforge.io/Main_Page](https://nsis.sourceforge.io/Main_Page) – drescherjm Mar 09 '23 at 13:38
  • 1
    @drescherjm is right, and since it looks like you are new to this, I would recommend looking into when and why you might choose static over dynamic linking and what they actually mean. You could start here https://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking for a quick comparison. – Andy Mar 09 '23 at 14:27
  • ***So now my problem is the error saying I'm missing 'libgomp-1.dll' and 'libwindthread-1.dll'.*** Those files should be in your MinGW bin folder also. You probably can't eliminate the dll dependency as a beginner. I recommend using an installer. – drescherjm Mar 09 '23 at 16:23
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 09 '23 at 16:26

0 Answers0