Solved

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

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 78
Ubuntu Apache Webserver - File Permissions 5 42
Help Required 2 32
centos commands 6 54
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…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

777 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