Go Premium for a chance to win a PS4. Enter to Win


Kdevelop and Opencv library's path linking problem, how specify path of libraries for compilation ?

Posted on 2010-09-12
Medium Priority
Last Modified: 2012-05-10

I have a the version 1.00 of Opencv I do a ./configure then a make to generate
the .la an the .so files.

I don't do the make install for making my programs independent of my system, the goal was
to put the .so and the .la files in a directory of my programs and not in the /usr/local/lib directory.

SO how can I specify into Kdevelop that when I do a compilation of my programs that the lining of library
was in a specify path and not in the /usr/local/lib ?

I must  put the .la and .so files into  my project directories for example /home/my_name/my_opencv_program/my_libraries?

I tried to change values of LDFLAGS like : "-L /home/my_name/my_opencv_program/my_libraries"
 and after compilation I receive error message like there is no specify format file in this path.

How can I specify in Kdevelop a path for linking outside the system and to a specify directories?

Thank you

Question by:Develprog
  • 3
  • 2

Author Comment

ID: 33659960

More exactly I do that:

Projects => Projects Otpions => Configure Options :

                  LDFLAGS = -L /home/name/my_programs/program_1/linux/bin_debug

but the compoil error is :

                  /usr/bin/ld: /home/name/my_programs/program_1/linux/bin_debug: No such File: file format not recognized

SO I want that when KDevelop compils it doesn't link to system bin but in a specifyed path, where in KDEvelop I can set this config ?

Thank you

LVL 18

Accepted Solution

TobiasHolm earned 2000 total points
ID: 33662604

How to link against a .so library?

When your project is GNU Autotools (Autoconf/Automake) based then you are most probably using the KDevelop Automake manager (see FAQ#Where is the Automake manager in KDevelop?).To link your program against a library, or to add a library do :
  • select the subproject you want to add the library to on the top view of the AutoMake manager.
  • select Options... with the RMB or hit the wrench icon
  • on the libraries ("compiler") tab add libs in the second box (link libraries outside of project). Just enter the lib name, without the lib prefix and the .a or .so or .la or what ever ending.
    • i.e if your lib is libsomelib.so, then you add it so: -lsomelib
  • If that library is not part of your system wide library path add -Lpath/to/the/library/you/used to the LDFLAGS in your Project->Project Options...->Configure Options->Linker Flags(LDFLAGS):.
Do not forget to add the the location of the library's .h files to the include path of your executable

Ref: http://www.kdevelop.org/index.html?filename=3.3/faq.html#How_to_add_an_external_include_path_to_a_project.3F

You should not have a space between the -L flag and your path.

Regards, Tobias

Author Comment

ID: 33668244
Thank you

>>select Options... with the RMB or hit the wrench icon
what is RMB ?

>>i.e if your lib is libsomelib.so, then you add it so: -lsomelib
I have more than one librairies, because Opencv has 4 libraries (libcv, libcvaux, libcxcore and libhighgui)
so must it be like this (-lcv, -lcvaux, lcxcore, -lhighgui ) ?

LVL 18

Expert Comment

ID: 33670463
RMB is "Right Mouse Button".

>so must it be like this (-lcv, -lcvaux, lcxcore, -lhighgui )
Yes. And if your library is not part of your system wide library path add -Lpath/to/the/library/you/used

Author Comment

ID: 33748814

Thank you it is done with by adding library path without space to '-L'


Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question