Linking to external Libraries

Israel Fdez Cabrera israel at seg.inf.cu
Tue Sep 16 20:37:53 UTC 2003


Hi
May be you are familiar with the way linux use the shared libraries. you
may have one or both of the following, a shared object .so or an object
library, .la. 
Linux names libraries using the "lib" word + "library name" + ".so",
(asume the library is in a standard location, /lib/, /usr/lib, etc...)
Supouse U want to with pthread library, the library name is
libpthread.so, ok, then Project Menu->Project Options (F7) -> Compiler
Options -> Linker Flags, Add this:

-lpthread

"-l" + "library name"

with no lib or .so.xxx

hope It help... best reg at rds 
Israel


On Tue, 2003-09-16 at 15:13, Friedrich Koester wrote:

> Hi there!
> 
> I know that this is probably a newbie question; but I've been looking for a 
> solution for several hours now and can't find anything useful.
> 
> I want to program in C using KDevelop 2.1.5 using KDE 3.1.1 under SuSE Linux 
> 8.2. I want to include an external library from Sourceforge (net-snmp). I 
> installed it GNU-like, and the .h-files reside in 
> /usr/local/include/net-snmp/ now. As a starting point I've tried to implement 
> an example program from a tutorial which can be found here:
> http://www.net-snmp.org/tutorial-5/toolkit/demoapp/index.html
> 
> I've successfully compiled and run that program using the Makefile provided on 
> that page. But in KDevelop, I seem to have problems linking to the libraries 
> which are included in the beginning of the file:
> #include <net-snmp/net-snmp-config.h>
> #include <net-snmp/net-snmp-includes.h>
> 
> The function calls referring to those libraries produce errors during 'make' 
> like these:
> main.o(.text+0x26): In function `main': 
> /home/[bla]/main.c:56: undefined reference to `init_snmp' 
> main.o(.text+0x38):/home/[bla]/main.c:61: undefined reference to 
> `snmp_sess_init' 
> main.o(.text+0x7f):/home/[bla]/main.c:75: undefined reference to `snmp_open' 
> main.o(.text+0x9e):/home/[bla]/main.c:79: undefined reference to `snmp_perror'
> and so on...
> 
> I've tried including those libraries by choosing Project -> Options -> Linker 
> Options -> additional libraries. I'm not sure about the format in which I'd 
> have to enter the reference to the libraries, though, and couldn't find any 
> information on that either.
> 
> My question is: where and in what format do I need to tell KDevelop about 
> those external libraries?
> 
> Thank you for any help
> Friedrich
> 
> -
> to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
> unsubscribe »your-email-address«

Israel Fdez Cabrera
Usuario Linux: 270292    (http://counter.li.org)
israel at seg.inf.cu
Segurmatica. Consultoría y Seguridad Informática
La Habana, Cuba.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20030916/89b8ae08/attachment.html>


More information about the KDevelop mailing list