Solved

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

Posted on 2010-09-12
5
1,751 Views
Last Modified: 2012-05-10
Hi,

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

 
0
Comment
Question by:Develprog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:Develprog
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


0
 
LVL 18

Accepted Solution

by:
TobiasHolm earned 500 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
0
 

Author Comment

by:Develprog
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 ) ?

 
0
 
LVL 18

Expert Comment

by:TobiasHolm
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
0
 

Author Comment

by:Develprog
ID: 33748814
Ok,

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



0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

632 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