I am using festival TTS c++ API in my program.I have downloaded all files from http://www.cstr.ed.ac.uk/downloads/festival/2.0.95/
and install festival and speech_tools successfully on my UBUNTU 10.04
now when compile my c++ programme gcc gives error:
g++ -L/usr/lib -L/home/peeyush/Desktop/festival/src/lib -L/home/peeyush/Desktop/speech_tools/lib -o"peeyush" ./src/peeyush.o -llibeststring.a -llibestbase.a -llibestools.a -llibFestival.a
/usr/bin/ld: cannot find -llibeststring.a
collect2: ld returned 1 exit status
make: *** [peeyush] Error 1
so please help me to sort out this error.
-Thanks
Peeyush Chandel(INDIA)
When using the -l option, you don't specify the leading lib or trailing .a or .so parts of the name as they're assumed by the linker. You would want to use something like -leststring to pick it up (assuming that your -L path is set correctly.
Alternately you can specify the exact filename (so no -l, just libeststring.a) as part of the object list to link (make sure the order is right relative to your .o files), but I believe in that case you would have to specify the path as the linker won't know to search your -L path. Easiest is to use -l though.
Related
I am working with the windows.h functions and everything works fine so far.
But when I try to use functions which require me to link external libraries something goes wrong.
In this case I am trying to use CreateFont(). I already know that I must link libwinmm.a and libgdi32.a and I've done that:
See this screenshot
But when I try to build the project i get following error messages:
g++ "-LD:\\Programme\\Eclipse\\lib" -o GameTest.exe "src\\choosemealmain.o" "src\\mealchooser.o" "-lD:\\Programme\\Eclipse\\lib\\libwinmm.a" "-lD:\\Programme\\Eclipse\\lib\\libgdi32.a"
d:/programme/eclipse/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lD:\Programme\Eclipse\lib\libwinmm.a
d:/programme/eclipse/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lD:\Programme\Eclipse\lib\libgdi32.a
collect2.exe: error: ld returned 1 exit status
I made sure to doublecheck whether the mentioned libraries are actually to be found in the mentioned path and they are.
I would be glad for any kind of help!
You are wrongly using quotes with -l flag. The -l flag also automatically adds the lib prefix and the .a extension. Your command line should be:
g++ -LD:\Programme\Eclipse\lib -o GameTest.exe "src\choosemealmain.o" "src\mealchooser.o" -lwinmm -lgdi32
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.
I have a very basic C++ project in code blocks that makes use of glfw.so and two other libraries that are compiled to .so files from another project, libHorde3D.so and libHorde3DUtils.so. The latter are placed in the project root folder, while glfw is somewhere in my /usr/lib (I think).
I have added the project folder to the linker and compiler search paths in code blocks. I have added the libHorde3D.so and libHorde3DUtils.so as well as glfw.so to the Link Libraries in the Linker Settings tab. I thought that this would be enough based on the previous similar questions here on stackoverflow.
However when I press build:
ld cannot find -lHorde3D.so
ld cannot find -lHorde3DUtils.so
ld cannot find -lglfw.so
My system is Arch Linux 64 and I am using GCC.
I also tried bopying libHorde3D.so and libHorde3DUtils.so in /usr/lib and /usr/lib64 with no success.
P.S. All search paths are copied across the Debug and Release target.
Say, if the library name is libmylibrary.so, then linker option to link against that library would look like -lmylibrary. Note that lib prefix and .so suffix are not there — they are added automatically by the linker. In your case it seems like you specified the wrong name. Try removing .so from it, that should solve the problem.
Here is a simple demonstration of how to trigger the failure by making a similar mistake:
$ echo 'int main() { return 0; }' > test.c
$ gcc -o test ./test.c -lc
$ gcc -o test ./test.c -lc.so
/usr/bin/ld: cannot find -lc.so
collect2: ld returned 1 exit status
$
The first command succeeds and the second one (with incorrect library name) fails.
You must not pass ".so". The linker options are
-lHorde3D -lHorde3DUtils -lglfw
This way the linker will search for "libHorde3D.so" etc. in the library path(s).
The packages I'm toying with here are rather unknown, but nevertheless the problem is rather generic. Basically, I'm trying to compile Python module (called rql) with C++ extension. The extension uses external framework called gecode, which contains several libraries. I compiled gecode and installed locally. Now, let the output speak for itself:
red#devel:~/build/rql-0.23.3$ echo $LD_LIBRARY_PATH
/home/red/usr/lib
red#devel:~/build/rql-0.23.3$ ls $LD_LIBRARY_PATH | grep libgecodeint
libgecodeint.so
libgecodeint.so.22
libgecodeint.so.22.0
red#devel:~/build/rql-0.23.3$ python setup.py build
running build
running build.py
package init file './test/__init__.py' not found (or not a regular file)
running build_ext
building 'rql_solve' extension
g++ -pthread -shared build/temp.linux-i686-2.5/gecode-solver.o -lgecodeint -lgecodekernel -lgecodesearch -o build/lib.linux-i686-2.5/rql_solve.so
/usr/bin/ld: cannot find -lgecodeint
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
LD_LIBRARY_PATH is for runtime linker/loader (same effect could be achieved with ldconfig ). What you need is the -L flag:
-L/home/red/usr/lib
on the compiler command line.
Edit:
And - thanks to #bjg for reminding me - you can use LIBRARY_PATH if you don't want to mess with compiler options.
You've apparently modified LD_LIBRARY_PATH to point to a non-standard location in your home directory. Do you know if LD_LIBRARY_PATH in the environment used to call g++ in setup.py matches your shell's environment?
See if you can pass arguments to setup.py to modify the library path or simply pass -L/home/red/usr/lib to g++.
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.