title: C++ running file with included library failes without compiling error (CMake / CLion)
body: <p>I got the following problem; I have my super library called mylib: it looks like this:</p>
  
  <p>My project folder is called library...
  <hr />
  <em>mylib.hpp</em></p>
  
  <pre><code>namespace XYZ {
  
  #ifndef LIBRARY_MYLIB_HPP
  #define LIBRARY_MYLIB_HPP
  
      int add(int, int);
  
  #endif //LIBRARY_MYLIB_HPP
  
  }
  </code></pre>
  
  <p><em>mylib.cpp</em></p>
  
  <pre><code>#include "mylib.hpp"
  
  namespace XYZ {
  
      int add(int a, int b) {
          return a + b;
      }
  
  }
  </code></pre>
  
  <p><hr />
  They are in the same directory.</p>
  
  <p>I Build it using CMake with the following CMakeLists.txt</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(library)
  
  add_library(library SHARED mylib.cpp)
  </code></pre>
  
  <p>Building Output:</p>
  
  <pre><code>[ 50%] Building CXX object CMakeFiles/library.dir/mylib.cpp.obj
  [100%] Linking CXX shared library liblibrary.dll
  [100%] Built target library
  </code></pre>
  
  <p>This works, this gives me a *.dll file like it's supposed to.
  <hr />
  <strong>I now try to use this library in my other project</strong></p>
  
  <p>I copied the .hpp file into the project location.
  my main.cpp looks like this:</p>
  
  <hr/>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "mylib.hpp"
  
  int main() {
      std::cout &lt;&lt; "Hello";
      std::cout &lt;&lt; XYZ::add(5, 7) &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p><em>CMakeLists.txt</em></p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(uselib)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  set(SOURCE_FILES main.cpp)
  add_executable(uselib ${SOURCE_FILES})
  target_link_libraries(uselib C:/User/........./liblibrary.dll)
  </code></pre>
  
  <p><em>Building output:</em></p>
  
  <pre><code>[ 50%] Building CXX object CMakeFiles/uselib.dir/main.cpp.obj
  [100%] Linking CXX executable uselib.exe
  [100%] Built target uselib
  </code></pre>
  
  <p><hr />
  Works. Well now to my problem.</p>
  
  <p>Once I try to start it, it crashes with the following exit code:</p>
  
  <pre><code>C:\Users\......\uselib.exe
  
  Process finished with exit code -1073741515 (0xC0000135)
  </code></pre>
  
  <p>When I comment the method call out, it works like a charm.</p>
  
  <p>I've been stuck here for hours, any help?</p>