I'm trying to get back to C++ using Mingw and Netbeans but all released .exe requires some .dll files if ran on another PC.
What should I do to add those library to the released .exe file. [I do not have too much experience in real C++ programming]
Please tell us what dll's are missing. but often you can find them in the bin folder of mingw. If you release your program, put those dll's where your exe is.
Alternative: use static linkage
Edit:
You can get this file from the bin folder of your mingw installation. Copy it to your exe
Compile with linker flags: -static-libstdc++ and -static-libgcc
Related
I installed Qt 6.3.1 libraries pre-built with MinGW 11.2.0 64-bit using the online installer. The application crashes without entering the main function when I use any of Qt libraries in the Qt Creator while there is no problem if I use only C++ standart library. I guess the problem is in linking. Because I realized that there are .a files in the folder C:\Qt-mingw\6.3.1\mingw_64\lib, even though I am using Windows 10. Why are .a files installed instead of .lib files? How to solve this issue?
Here are the the selections that I made when installing Qt libraries using the online installer:
After learning that the problem may be due to duplication of some library from here, I saw using dependency walker that my program uses libstdc++-6.dll in system32 instead of qt-mingw installation. So the problem solved when I copied that dll into my app's folder. But I wonder how to solve this by changing the path without copying libstdc++-6.dll into app's folder. Because even though I put qt-mingw bin folder at the very beginning in system path, app uses still the one in system32.
I'm working on a game in SFML. It runs correctly on my computer, but if I send it to another computer then when I try to run it I get errors about not being able to find libraries. I did some research and I found that the reason is because I was using dynamic libraries, and to get the program to work on its own I need the static libraries. But how do I get those? They aren't in my sfml folder. I tried doing more research but I can't find a way to build or download those libraries.
Just go to your sfml Src directory and look for the /bin folder. Copy the following DLLs to your game folder where your exe is located:
DLLs
sfml-graphics.dll
sfml-window.dll
sfml-audio.dll
sfml-network.dll
sfml-system.dll
On Linux, install libsfml-dev on target computer.
I am sure you are using mingw compiler. You can add static arguments and try.
-static-libgcc -static-libstdc++
If this doesn't work try to search the two DLL files in your standard compiler path /bin folder and place them where your exe is located.
C++-Protobuf does not compile in VS2012. Now I want to use MinGW to compile it on windows. Can someone please give me some brief headwords on how to compile protobuf on Win7 x64. I already installed MinGW with the GUI installer. Google writes as MinGW setup notice that I should refer to the Unix installation notes. But I cant figure out how to use the auto tools on windows.
Edit
Okay this is what I've done until now:
$ mount C:/ WinDir
$ cd ./[...]/protobuf.2.4.1
$ ./configure
$ minGW32-make.exe
$ minGW32-make.exe check
minGW32-make.exe runs without errors, but no tests are running and I cant find libprotobuf.lib. There are some libprotobuf.dll but I need the lib, dont I?.
You should have an MSys console together with your MinGW instalation. This console provides an linux-like environment in which you should be able to use autotools normally.
If MSys is not installed, you can grab it from the MinGW site too.
cd to your directory with sources and try the usual:
$ ./configure
$ make
Some libraries cause problems on Windows but most compile well with MinGW and MSys. Come back and add more info to your question if you run into specific problems.
Edit:
minGW32-make.exe runs without errors, but no tests are running and I cant find libprotobuf.lib. There are some libprotobuf.dll but I need the lib, dont I?.
Usually for a dynamic library you'd get protobuf.dll (the dynamic library) and libprotobuf.a (the static wrapper library).
When linking, just pass -lprotobuf to the linker - it will look for both libprotobuf.a and protobuf.lib.
(.lib is another static library format, which is partially handled by MinGW but not native here.)
You will not work with a .lib file when using the MinGW toolchain. Instead, you are able to link against the dll directly. The MinGW Wiki explains this.
I could get dll and lib both. This is when you do not want static lib file and want to use dll and lib file.
You need to make following changes in Protobuf code:
Open the project in VS. Or any other editor. I use VS2015.
In libProtoBuf project settings, in C/C++ Preprocessor add following flags.
PROTOBUF_USE_DLLS; LIBPROTOBUF_EXPORTS;
Those flags will export information from profobuf using dllexport
in ur client code where you are using Protobuf, define: PROTOBUF_USE_DLLS. Which will make protobuf includes to use dllimport.
Once you do step 2, you will see both dll and lib in your output folder. Otherwise, you will always see just dll and not lib file.
Hope this helps. If not, please write a message here and I can help you getting this sorted out.
Okay, so I have a C++ project that uses SFML, and I want to be able to compile it from the CMD using MinGW. I have it so I can compile.cpp's, however, I just need to know what more I have to do in order for it to work with SFML. I tried compiling it with CodeBlocks and MinGW, and it works fine, until I try to run it, at which point it tells me that sfml-system.dll is missing from my computer. Does this mean I installed it incorrectly? I followed the CodeBlocks installation down to the letter, from what I could tell... I put the include\SFML in the include\ of MinGW, and I put all the *.a's from lib\ into the \lib of MinGW as well.
Thank you for the help you can give!
Ok, so if it builds well and links with the sfml-system.dll at link time then there is no real problem. All you need to do is copy the sfml-system.dll (or make a link to it) in the directory, where the built .exe file is. That would make the .exe find the required library.
libgcc_s_dw2-1.dll is just inside bin folder, on latest MinGW releases.
Copy to .exe folder, it should run.
I have only previously used visual studio for developing c++ but I've just moved to netbeans and am having some issues.
I got mingw installed so that my projects will compile but I dont know how to add external libraries to that. I want to use a static library, not a dll.
The library I specifically am looking at is libpng
I hope this isn't too IDE specific, I'm also looking to know how to prepare the library.
Windows OS.
I figured it out more or less. I used the cmake gui, configured for msys make and mingw g++ and gcc, on the zlib source directory and then ran msys make and make install on the output directory. After that I did the same on libpng, but I had to add some variables to point to the zlib include and library directories within cmake.
Then in netbeans, I right clicked>>properties on my project and added include and lib location for each of the two libraries. I also could have copied the files into my mingw directories.
Now I'm just stuck with this issue.