Solved

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

Posted on 2010-09-12
5
1,689 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
Comment Utility

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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
Ok,

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



0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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.

763 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

16 Experts available now in Live!

Get 1:1 Help Now