I've compiled a C++ program and it's perfectly working on my computer, but if my friend tries to launch the program, it says libgcc_s_sw2-1.dll
is missing. How I can include all the required GCC runtime libraries with the program using CMake?
相关问题
- Error building gcc 4.8.3 from source: libstdc++.so
- What are the recommended GNU linker options to spe
- What is the right order of linker flags in gcc?
- Avoid cmake to add the flags -search_paths_first a
- CMakeList file to generate LLVM bitcode file from
相关文章
- gcc/g++ gives me error “CreateProcess: No such fil
- Calls that precede a function's definition can
- How can I use gcc's -I command to add recursiv
- How do I know if std::map insert succeeded or fail
- How to specify gcc flags (CXXFLAGS) particularly f
- How to generate assembly code with gcc that can be
- Embedding a program's source code into its bin
- C++ compiler error in netbeans
As rubenvb correctly answers: libgcc is required or you should add
CMAKE_EXE_LINKER_FLAGS=-static
to your CMakeLists.txt.As an alternative, you could try to find libgcc_s_sw2-1.dll in your MinGW installation and "package" it with your installation using InstallRequiredSystemLibraries. This integrates nicely with CPack as well.
E.g. in my own code, I have:
Later on, in the part which prepares an install or package:
The libgcc dll is required by all programs compiled with GCC. If you don't want to redistribute this DLL with your program, you must link statically by passing
-static
to the linker, or in CMake:This is specific for GCC.