libraries not found in c++ code using a 3rd party header file - c++

I am getting a error when I try to compile some c++ code using the olcPixelGameEngine as a header file, the error is -
/usr/bin/ld: cannot find -lGL
/usr/bin/ld: cannot find -lpng

Depending on the code being compiled, the error message may look like:
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find -lltdl
/usr/bin/ld: cannot find -lXlst
The xxx represents the name of the library, for example, libc.so, libltdl.so, libXtst.so. The naming rule is: lib + library name (i.e. xxx) + .so.
There are 3 possible reasons for such error to occur:
The lib is not installed in the system;
Incorrect version of the installed lib;
Incorrect symbolic link for the lib (.so file). The link is not linked to the correct .so file.
Solutions:
Check whether the symbolic link is correctly linked to the .so file in /usr/lib and correct any incorrect link.
For example,
If the error message "/usr/bin/ld: cannot find -lXlst" is caused by incorrect symbolic link, issue the commands below to correct it.
cd /usr/lib
ln -s libXtst.so.6 libXtst.so
If the problem is not caused by incorrect symbolic link, then it's likely caused by missing lib. In this case, missing lib needs to be installed.
For example,
If the error message "/usr/bin/ld: cannot find -lXlst" is caused by missing "libXtst.so" under "/usr/lib", issue the command below to install it.
apt-get install libxtst-dev
Additional note on how to install the missing lib.
Identify the missing lb
Error Message Missing lib
/usr/bin/ld: cannot find -lc ---------------------------------------------------->libc
/usr/bin/ld: cannot find -lltdl ---------------------------------------------------->libltdl
/usr/bin/ld: cannot find -lXlst ----------------------------------------------------> libXtst
Search for the missing lib
apt-cache search libc-dev
apt-cache search libltdl-dev
apt-cache search libXtst-dev
Install the missing lib.
please refer below link. this might help.
http://wei48221.blogspot.com/2017/08/linux-how-to-solve-problem-of-usrbinld.html

Related

wsdlpull: linking error with g++

I'm new to programming c++ with g++ and have big problems to get wsdlpull-library to work. The version is 1.24.
I followed the installation steps from http://wsdlpull.sourceforge.net/.:
./configure --prefix=/home/jesse/Dropbox/Programmering/C++/test --disable-opt --enable-examples
make
make install
I then copied print.cpp file from the example to the "prefix"-directory. The next step would be "add the $(prefix)/include in your include path and add $(prefix)/libs and -lwsdl -lschema -lxmlpull to your LDFLAGS". The first problem is that there's no folder "libs" but "lib" and the include-folder has another folder inside named wsdlpull. Therefore I instead entered the following command:
g++ -I include/wsdlpull -L lib -lwsdl -lschema -lxmlpull -o print print.cpp
This resulted in the following error:
/usr/bin/ld: cannot find -lwsdl
/usr/bin/ld: cannot find -lschema
/usr/bin/ld: cannot find -lxmlpull
collect2: error: ld returned 1 exit status
I have no idea what this means, why does it look in /usr/bin/ld when I point to "lib"?
When you use -L lib, it means that, lib dir is available in pwd where you are doing make. Check whether you have said lib is really available or not.
To make things simple, you can give the absolute path of the lib folder.
i.e -L<path to lib>/lib. This would help the make to see the lib without any confusions.
Next, you might want to explicitly specify whether libwsdl is a static or shared library. Although this is optional.
Or, the best solution is to place the libraries in system libs location i.e /lib or /usr/lib or /use/local/lib and run ldconfig such that the linker/loader knows where the newly added libraries exists. In such case, you can simple issue -lwsdl without specifying the -L flag.
For more info, please refer ldconfig.

using sndfile library when compiling 32bit linux application on Fedora 20 x86_64

I'm currently using Fedora 20 x86_64.
I've built libsndfile with these commands:
sudo ./configure BASE_FLAGS=-32
sudo make
sudo make install
This all goes well and I can find the compiled library in /usr/local/lib.
I want to use this in an application that will be built in 32bit.
The problem occurs when I try to compile that application. I get the following error:
/usr/bin/ld: skipping incompatible /builddir/Code/Platformer/../Dependencies/libsndfile/lib/Linux/libsndfile.so when searching for -lsndfile
/usr/bin/ld: skipping incompatible /builddir/Code/Platformer/../Dependencies/libsndfile/lib/Linux/libsndfile.a when searching for -lsndfile
/usr/bin/ld: cannot find -lsndfile
The "skipping incompatible" might suggest that I'm doing something wrong when compiling sndfile but since I'm kind of new to this I can't find what it is. I tried different configurations but they all have the same result.
If this needs more code or something, let me know what you need.
For anyone with the same problem - try to look here:
ld cannot find an existing library
Generally there is probably a symlink missing, because the '-devel' library is not istalled. That is why
sudo yum install libsndfile-devel.*
fixed it for me.

Issue with building Teigha SDK: 'cannot find -lJpeg'

I'm trying to build Teigha SDK in Ubuntu 12.04. I got the following linking error:
/usr/bin/ld: cannot find -lJpeg
/usr/bin/ld: cannot find -lJpeg
libjpeg has alredy been installed on my machine. What else is missing?
libjpeg has alredy been installed on my machine. What else is missing?
/usr/bin/ld: cannot find -lJpeg
^
Note the uppercase letter! The linker is missing a libJpeg.a (or other archive format) file, or an appropriate -L<path> option to resolve it.

error in compiling using cmake utility

I am trying to compile my gcc code using the following make command .
OS :Redhat ,gcc - 4.1
But I am getting error as follows :
rmtrain#lintrni130 $ /usr/local/bin/make all
[ 21%] Built target GCVCore
Linking CXX executable CFE
/usr/bin/ld: warning: libicui18n.so.36, needed by ../../Generic/icu/lib/libicuio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libxalanMsg.so.110, needed by ../../Generic/Xalan/lib/libxalan-c.so, not found (try using -rpath or -rpath-link)
CMakeFiles/CFE.dir/trnuser1/rmtrain/DevelopmentEnv/Generic/ConvUI/GCVConvUISetting.o: In function `xercesc_2_6::XMLAttDefList::~XMLAttDefList()':
GCVConvUISetting.cpp:(.text._ZN11xercesc_2_613XMLAttDefListD0Ev[xercesc_2_6::XMLAttDefList::~XMLAttDefList()]+0x2f): undefined reference to `xercesc_2_6::XMemory::operator delete(void*)'
Please Help with this .
The warnings means that some libraries you link to have dependencies on other shared libraries, and those libraries weren't found in the linker's search path. The linker manual describes how it forms that search path in the docs for the -rpath-link option
They're only warnings, so haven't caused your link to fail. It will be a problem if those required libs aren't found at run-time, but is not necessarily a problem at link-time.
If you want to silence the warnings you will need to find out which directory contains libicui18n.so.36 and libxalanMsg.so.110 and use one of the methods described in the manual to tell the linker to look in that directory.
The last line is the real problem, and indicates you are not linking to the library which defines that symbol. You'll need to find out which library it is and link to it with -lfoo, it will probably be something like -lxerces
i reinstalled icu 3.2 instead of 3.6.It worked fine then.

Boost linkage error in Eclipse

I've been banging my head fruitlessly against the wall attempting to include boost's thread functionality in my Eclipse C++ project on Ubuntu.
Steps so far:
Download boost from boost.org
./configure --with-libraries=system,thread
make
sudo make install
sudo ldconfig -v
In the eclipse project, set the include directory to:
/usr/local/include/boost-1_38/
In the linker set the library(-l) to "boost_thread"
Set the search path (-L) to
/usr/local/lib
Linker runs, returns with ld error
/usr/bin/ld: cannot find -lboost_thread
as follows:
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o"boostHello3" ./src/boostHello3.o -lboost_thread
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
Here are relevant entries from /usr/local/lib:
libboost_system-gcc43-mt-1_38.a
libboost_system-gcc43-mt-1_38.so
libboost_system-gcc43-mt-1_38.so.1.38.0
libboost_system-gcc43-mt.a
libboost_system-gcc43-mt.so
libboost_thread-gcc43-mt-1_38.a
libboost_thread-gcc43-mt-1_38.so
libboost_thread-gcc43-mt-1_38.so.1.38.0
libboost_thread-gcc43-mt.a
libboost_thread-gcc43-mt.so
Here are the contents of /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/lib
How is the linker missing this?
Well, the linker tries to find a library called "libboost_thread.a" (or "libboost_thread.so") in its search path, which you apparently don't have.
Either create an appropriate link, or use "-lboost_thread-gcc43-mt"
Your linker line should be saying -lboost_thread-gcc43-mt-1_38.