J
J
J. Snow2018-02-06 12:43:49
C++ / C#
J. Snow, 2018-02-06 12:43:49

CLion: program cannot be started, missing dll; How to decide?

I'm trying to write a mini-programming line in C++, and I came across a problem with the build. When you start from the IDE, everything is OK, but you can’t run the exe separately , it swears at the lack of libraries.
5a797885e912c325727256.png
CMakeLists:

cmake_minimum_required(VERSION 3.6)
project(proxyyy)

set(CMAKE_CXX_STANDARD 11)

set(SOURCE_FILES test.cpp)
add_executable(proxyyy ${SOURCE_FILES})

UPD:
I guess that you can just take the dll and put it somewhere nearby, but I would like to have a single exe file as the output. As far as I know, CodeBlocks by default just includes everything you need right in the exe.
UPD:
The solution was this line (more details here ):
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2018-02-06
@j-snow

You can include everything explicitly. Read about static assembly.
I don’t know what you are building with, but you can add something like, for gcc: , to the linker flags -static-libstdc++ -static-libgcc. Perhaps under Windows something else will have to be linked statically. The size of the executable file will increase, of course.
And if you want to achieve results like in CodeBlocks, then just look at what flags this IDE adds to the Makefile and add the same.

A
Alexander Ananiev, 2018-02-06
@SaNNy32

Well, put the required library file next to the program

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question