Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
Alatius is currently offline  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 #3073 is a reply to message #3072] Sat, 06 May 2006 00:40 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
I'm no prof with Ultimate++ on Linux but I would suggest to add your libs using menu Project->ProjectOrganizer. You can study some examples in that window after click on Core package. Then try something similar for your package.
Re: How to use third party libraries? (Newbie alert!) [message #3093 is a reply to message #3072] Sat, 06 May 2006 21:08 Go to previous messageGo to next message
Alatius is currently offline  Alatius
Messages: 2
Registered: May 2006
Junior Member
Yep, that seems to do the trick! Thank you.
Re: How to use third party libraries? (Newbie alert!) [message #7893 is a reply to message #3093] Tue, 30 January 2007 16:14 Go to previous messageGo to next message
ebojd is currently offline  ebojd
Messages: 225
Registered: January 2007
Location: USA
Experienced Member
Thanks fudadmin,

This would be a nice detail to add to the tutorial and manual. I poked around a little in the manual and did not find anything. Poking around theide I kept looking sunder settings, build, etc. to no avail...
Re: How to use third party libraries? (Newbie alert!) [message #10264 is a reply to message #3072] Thu, 28 June 2007 12:01 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
in this way, the library is linked statically.
i put the program in another machine without dll and it runs ok.
Re: How to use third party libraries? (Newbie alert!) [message #10267 is a reply to message #10264] Thu, 28 June 2007 18:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
bonami wrote on Thu, 28 June 2007 06:01

in this way, the library is linked statically.
i put the program in another machine without dll and it runs ok.



Is that complaint or praise? Smile

Note that this depends on two things:

- first, if .lib just represents .dll, it is linked as shared, if it represents static library, it is linked static.

- if there are both forms (.a and .so on Linux) of library available, the result depends on "All static" vs "Use shared libraries" settings.

Mirek
Re: How to use third party libraries? (Newbie alert!) [message #10273 is a reply to message #3072] Fri, 29 June 2007 03:33 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
here's the case,

i have an EZCommon library, and an EZComm using it.
under nonGUI linux, it is a .so and a executable.

in upp (IDE), i'm puzzeld by the notions of assebly and package.
now i've got a default MyApp assembly and created two packages EZCommon and EZcomm. EZCommon generates a .dll now.
if they don't contain each other, linkage fails. if EZCommon contains EZComm, EZCommon is not linked as a dynamic .dll.
i set the option using shared libs. it runs well on another machine, so .dll is not used.
what shall i do Confused
Re: How to use third party libraries? (Newbie alert!) [message #10275 is a reply to message #10273] Fri, 29 June 2007 08:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am afraid there are too many unspecified variables now about your project Smile

Anyway, maybe instead of lengthy process of asking... could you please just .zip the stuff (packages you have created) and post here? It will be faster Smile

Mirek

[Updated on: Fri, 29 June 2007 08:21]

Report message to a moderator

icon14.gif  Re: How to use third party libraries? (Newbie alert!) [message #10277 is a reply to message #3072] Fri, 29 June 2007 09:39 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
i always hesitate of uploading all my files, just because it seems a burden to you. i want to describe it. now that you are so kind, i append it. Very Happy
  • Attachment: MyApps.zip
    (Size: 6.57KB, Downloaded 453 times)
Re: How to use third party libraries? (Newbie alert!) [message #10284 is a reply to message #10277] Fri, 29 June 2007 16:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hm, I am little bit confused - there seems to be no connection between both packages.

What is the purpose of "ezcommon"? It seems to be just the empty stub for .dll...
Re: How to use third party libraries? (Newbie alert!) [message #10316 is a reply to message #3072] Mon, 02 July 2007 03:38 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
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
Re: How to use third party libraries? (Newbie alert!) [message #10319 is a reply to message #10316] Mon, 02 July 2007 08:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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
icon11.gif  Re: How to use third party libraries? (Newbie alert!) [message #10324 is a reply to message #3072] Mon, 02 July 2007 09:57 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
change exe's function to use dll's class,

GUI_APP_MAIN
{
ezcommwin ezcw;
ezoi i;

i.mem();
ezcw.Run();
}

and exe still runs without dll. and build does not generate a dll. thus, package inclusion does not yield any linkage, if you set "use shared libs". if i set "all shared" build complians sth. failure in iml.
i think i should not include ezcommon package, but must add it as a library through package organizer. it now fails in linage and i still have not yet figured out where to put dll. system32 seems not working.
Re: How to use third party libraries? (Newbie alert!) [message #10326 is a reply to message #10324] Mon, 02 July 2007 10:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Using class does not necessarily create link requirement.

There must be some call to non-inline method AFAIK.
Re: How to use third party libraries? (Newbie alert!) [message #10327 is a reply to message #10326] Mon, 02 July 2007 10:22 Go to previous message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
anyway i've succeeded link a .dll, assigning a linkage option.

[Updated on: Tue, 10 July 2007 03:38]

Report message to a moderator

Previous Topic: How can I attach Layouts to LabelBox as a TabMenu replacement?
Next Topic: UVS2 usage
Goto Forum:
  


Current Time: Thu Mar 28 11:48:29 CET 2024

Total time taken to generate the page: 0.01109 seconds