Home » U++ TheIDE » U++ TheIDE: Packages » How to use third party libraries? (Newbie alert!)
How to use third party libraries? (Newbie alert!) [message #3072] |
Sat, 06 May 2006 00:00  |
Alatius
Messages: 2 Registered: May 2006
|
Junior Member |
|
|
This question may sound a bit naive, but I hope you can bear with me, and that you, in case my question demands too long an answer, at least may be able to point me in the right direction... For you to understand my question better, it should be noted that, while I am not new to programming, I have never developed a GUI application in C++ before, or for that matter any moderately complicated project. My understanding of, for example, the inner working of the process of "linking" files, is what I describe as sketchy, at best. On top of this, I have just recently switched to Linux (Ubuntu), so I am a bit of a newbie in that regard as well.
Anyhow, my question is, simply, how do I make use of a third party library in my project? To take a concrete example, I want to use functions provided by the libsndfile library (http://www.mega-nerd.com/libsndfile/), (which is written in C, but I hope that won't be a problem). Instead of downloading the tar-file from that site, I installed the library through Synaptic (Ubuntu's package manager), specifically the packages libsndfile1 and libsndfile1-dev. So far, so good (I guess.) Of the files that got installed on my system, I guess these are relevant:
From libsndfile1 (is it necessary, by the way?):
/usr/lib/libsndfile.so.1.0.10
/usr/lib/libsndfile.so.1
From libsndfile1-dev:
/usr/include/sndfile.h
/usr/lib/libsndfile.a
/usr/lib/libsndfile.la
/usr/lib/libsndfile.so
/usr/lib/pkgconfig
/usr/lib/pkgconfig/sndfile.pc
Now, when I want to use this library, I start to get problems though. I tried to add
#include <sndfile.h>
to the top of my main.cpp, but this alone won't quite do it, it seems, as, during the linking phase, I get some errors:
"Linking...
/home/alatius/upp/out/test1/GCC32.Debug_full.Gui.Main.Shared /main.o: In function "test1":
/home/alatius/upp/MyApps/test1/main.cpp:236: undefined reference to `sf_command'
/home/alatius/upp/MyApps/test1/main.cpp:236: undefined reference to `sf_command'
collect2: ld returned 1 exit status"
(Here, line 236 contains the call "sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer));", copied straight from the sndlib documentation.)
Well, I don't really know what to do now, I'm afraid. Do I have to somehow add the library to my project in TheIDE? Or somehow tell the linker where to find sndlib?
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: How to use third party libraries? (Newbie alert!) [message #10319 is a reply to message #10316] |
Mon, 02 July 2007 08:33   |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
bonami wrote on Sun, 01 July 2007 21:38 | yeah. no connection so far, since i just coded.
common is a library for all other applications in my project, providing result enum definition, I/O capsulation, etc.
the whole project is far more than this.
http://ezproject.sourceforge.net
|
Well, as there is no connection and no public symbols in the .dll, perhaps it is the reason why .dll is not required on another machine? (I mean, perhaps linker just excludes it alltogether, just like it does for unreferenced static libraries..)
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 09 15:50:34 CEST 2025
Total time taken to generate the page: 0.02165 seconds
|