When I try to run .exe
from cmake-build-debug
I have an error:
"libgcc_s_dw2-1.dll not found".
How to build standalone .exe
without any dlls
. I use CLion 2017.2.4, MinGW 5.0, cmake 3.9.4
By default, CLion stores user-specific files for each IDE instance (configuration, caches, plugins, logs, and so on) in the user's home directory.
Create a new C/C++ source fileIn the Project tool window, select the directory in which you want to add new files. Right-click it and select New | C/C++ Source File from the context menu. In the dialog that opens: Specify the name of a file.
I did it.
To do this you need to add to the file CMakeLists.txt
this line:
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
After this CMakeLists.txt
shoud look like this:
cmake_minimum_required(VERSION 3.9)
project(MyProject)
set(CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
set(SOURCE_FILES main.cpp)
add_executable(MyProject${SOURCE_FILES})
Reload changes in CMakeLists.txt
Run -> Clean
Run -> Build
Now .exe
file is standalone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With