Solved

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

Posted on 2010-09-12
5
1,703 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
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now