title: Why do I get Error while loading shared libraries
body: <p>I installed wxWidgets 3.1.2 from source code on my computer with Fedora in /home/... And I am trying to build and run a Hello world example from <a href="https://docs.wxwidgets.org/stable/overview_helloworld.html" rel="nofollow noreferrer">https://docs.wxwidgets.org/stable/overview_helloworld.html</a>. It compiles without any error by typing</p>
  
  <pre><code>g++ widgetTest.cpp `wx-config --cxxflags --libs` -o widgetTest
  </code></pre>
  
  <p>But after <code>./widgetTest</code> I get <code>./widgetTest: error while loading shared libraries: libwx_gtk2u_xrc-3.1.so.2: cannot open shared object file: No such file or directory</code> in my shell.</p>
  
  <p>One answer in stackoverflow says to copy whole library in <code>/usr/lib</code> and I did it. Then it did not work and I got the same again.</p>
  
  <p>(gtk2-devel and gtk3-devel I have already installed before installing wxWidgets)</p>
  
  <p><code>ldd ./widgetTest</code> returns:</p>
  
  <pre><code>linux-vdso.so.1 (0x00007ffeacdcf000)
  libwx_gtk2u_xrc-3.1.so.2 =&gt; not found
  libwx_gtk2u_html-3.1.so.2 =&gt; not found
  libwx_gtk2u_qa-3.1.so.2 =&gt; not found
  libwx_gtk2u_core-3.1.so.2 =&gt; not found
  libwx_baseu_xml-3.1.so.2 =&gt; /lib64/libwx_baseu_xml-3.1.so.2 (0x00007ffa3faea000)
  libwx_baseu_net-3.1.so.2 =&gt; /lib64/libwx_baseu_net-3.1.so.2 (0x00007ffa3fa9a000)
  libwx_baseu-3.1.so.2 =&gt; /lib64/libwx_baseu-3.1.so.2 (0x00007ffa3f7e9000)
  libstdc++.so.6 =&gt; /lib64/libstdc++.so.6 (0x00007ffa3f651000)
  libm.so.6 =&gt; /lib64/libm.so.6 (0x00007ffa3f4cd000)
  libgcc_s.so.1 =&gt; /lib64/libgcc_s.so.1 (0x00007ffa3f4b2000)
  libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x00007ffa3f490000)
  libc.so.6 =&gt; /lib64/libc.so.6 (0x00007ffa3f2ca000)
  libexpat.so.1 =&gt; /lib64/libexpat.so.1 (0x00007ffa3f28b000)
  libz.so.1 =&gt; /lib64/libz.so.1 (0x00007ffa3f271000)
  libdl.so.2 =&gt; /lib64/libdl.so.2 (0x00007ffa3f26b000)
  libsecret-1.so.0 =&gt; /lib64/libsecret-1.so.0 (0x00007ffa3f214000)
  libgobject-2.0.so.0 =&gt; /lib64/libgobject-2.0.so.0 (0x00007ffa3f1be000)
  libglib-2.0.so.0 =&gt; /lib64/libglib-2.0.so.0 (0x00007ffa3f09e000)
  liblzma.so.5 =&gt; /lib64/liblzma.so.5 (0x00007ffa3f073000)
  /lib64/ld-linux-x86-64.so.2 (0x00007ffa3fb26000)
  libgcrypt.so.20 =&gt; /lib64/libgcrypt.so.20 (0x00007ffa3ef55000)
  libgpg-error.so.0 =&gt; /lib64/libgpg-error.so.0 (0x00007ffa3ef32000)
  libgio-2.0.so.0 =&gt; /lib64/libgio-2.0.so.0 (0x00007ffa3ed86000)
  libpcre.so.1 =&gt; /lib64/libpcre.so.1 (0x00007ffa3ed13000)
  libffi.so.6 =&gt; /lib64/libffi.so.6 (0x00007ffa3ed06000)
  libgmodule-2.0.so.0 =&gt; /lib64/libgmodule-2.0.so.0 (0x00007ffa3ed00000)
  libselinux.so.1 =&gt; /lib64/libselinux.so.1 (0x00007ffa3ecd3000)
  libresolv.so.2 =&gt; /lib64/libresolv.so.2 (0x00007ffa3ecb9000)
  libmount.so.1 =&gt; /lib64/libmount.so.1 (0x00007ffa3ec5c000)
  libpcre2-8.so.0 =&gt; /lib64/libpcre2-8.so.0 (0x00007ffa3ebd4000)
  libblkid.so.1 =&gt; /lib64/libblkid.so.1 (0x00007ffa3eb81000)
  libuuid.so.1 =&gt; /lib64/libuuid.so.1 (0x00007ffa3eb78000)
  librt.so.1 =&gt; /lib64/librt.so.1 (0x00007ffa3eb6e000)
  </code></pre>