title: Fixing undefined reference to dlopen and dlcose
body: <p>I have created simple c++ application. I can compile it and t works fine. But now I need to load library dynamically and I have added dlfnc.h to my project and added some more code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;dlfcn.h&gt;
  void *mylib;
  int eret;
  
  using namespace std;
  
  int main() {
  
      mylib = dlopen("mylib.so", RTLD_LOCAL | RTLD_LAZY);
      eret = dlclose(mylib);
  
      cout &lt;&lt; "!!!Hello World!!!" &lt;&lt; endl; // prints !!!Hello World!!!
      return 0;
  }
  </code></pre>
  
  <p>Compiling:</p>
  
  <pre><code>myname@ubuntu:~/workspace/LinuxGcc/src$ g++ LinuxGcc.cpp 
  </code></pre>
  
  <p>And got compilation error:</p>
  
  <pre><code>/tmp/ccxTLiGY.o: In function `main':
  LinuxGcc.cpp:(.text+0xf): undefined reference to `dlopen'
  LinuxGcc.cpp:(.text+0x25): undefined reference to `dlclose'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p><code>dlfcn.h</code> exist in <code>/usr/include/</code></p>
  
  <p>Where is problem?</p>