<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[dynamisches Linken einer Bibliothek]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein Programm zu schreiben, das meine Musikbibliothek sortiert. Dazu müssen ID3v2 tags ausgelesen und geschrieben werden können - ich möchte dafür die Bibliothek &quot;taglib&quot; verwenden.</p>
<p>Der g++ kompiliert das Programm problemlos, aber der Linker findet die Funktionen aus der Bilbiothek nicht.<br />
Ein Minimalbeisiel:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;tag.h&gt;
#include &lt;fileref.h&gt;

using namespace std;

int main ()
{
	TagLib::FileRef f (&quot;eins.mp3&quot;);
	TagLib::String artist = f.tag()-&gt;artist(); 
	TagLib::String track = f.tag()-&gt;title();

	cout &lt;&lt; artist &lt;&lt; &quot; - &quot; &lt;&lt; track &lt;&lt; endl;
}
</code></pre>
<p>Wenn ich den g++ aufrufe erhalte ich folgendes:</p>
<pre><code>***$ g++ -I/usr/local/include/taglib -L/usr/local/lib -ltag  -o minbsp minbsp.cpp
/tmp/cceGpO7N.o: In function `main':
minbsp.cpp:(.text+0x20): undefined reference to `TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)'
minbsp.cpp:(.text+0x2c): undefined reference to `TagLib::FileRef::tag() const'
minbsp.cpp:(.text+0x4e): undefined reference to `TagLib::FileRef::tag() const'
minbsp.cpp:(.text+0x75): undefined reference to `operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, TagLib::String const&amp;)'
minbsp.cpp:(.text+0x91): undefined reference to `operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, TagLib::String const&amp;)'
minbsp.cpp:(.text+0xaa): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xb6): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xc2): undefined reference to `TagLib::FileRef::~FileRef()'
minbsp.cpp:(.text+0xdd): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xee): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xff): undefined reference to `TagLib::FileRef::~FileRef()'
collect2: ld gab 1 als Ende-Status zurück
</code></pre>
<p>Ich übergebe dem g++ den Pfad zur Bilbiothek (/usr/local/lib), dort ist die Bilbiohtek auch vorhanden (<a href="http://libtag.so" rel="nofollow">libtag.so</a>). Wieso findet er die Bilbiothek nicht? Und wieso beschwert sich der Linker überhaupt, schließlich möchte ich die Bilbiothek ja dynamsich (und nicht statisch) linken. D.h. er müsste doch eigentlich erst zur Laufzeit meckern...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318386/dynamisches-linken-einer-bibliothek</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 16:08:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318386.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Jul 2013 20:57:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to dynamisches Linken einer Bibliothek on Wed, 10 Jul 2013 20:57:41 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein Programm zu schreiben, das meine Musikbibliothek sortiert. Dazu müssen ID3v2 tags ausgelesen und geschrieben werden können - ich möchte dafür die Bibliothek &quot;taglib&quot; verwenden.</p>
<p>Der g++ kompiliert das Programm problemlos, aber der Linker findet die Funktionen aus der Bilbiothek nicht.<br />
Ein Minimalbeisiel:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;tag.h&gt;
#include &lt;fileref.h&gt;

using namespace std;

int main ()
{
	TagLib::FileRef f (&quot;eins.mp3&quot;);
	TagLib::String artist = f.tag()-&gt;artist(); 
	TagLib::String track = f.tag()-&gt;title();

	cout &lt;&lt; artist &lt;&lt; &quot; - &quot; &lt;&lt; track &lt;&lt; endl;
}
</code></pre>
<p>Wenn ich den g++ aufrufe erhalte ich folgendes:</p>
<pre><code>***$ g++ -I/usr/local/include/taglib -L/usr/local/lib -ltag  -o minbsp minbsp.cpp
/tmp/cceGpO7N.o: In function `main':
minbsp.cpp:(.text+0x20): undefined reference to `TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)'
minbsp.cpp:(.text+0x2c): undefined reference to `TagLib::FileRef::tag() const'
minbsp.cpp:(.text+0x4e): undefined reference to `TagLib::FileRef::tag() const'
minbsp.cpp:(.text+0x75): undefined reference to `operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, TagLib::String const&amp;)'
minbsp.cpp:(.text+0x91): undefined reference to `operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, TagLib::String const&amp;)'
minbsp.cpp:(.text+0xaa): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xb6): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xc2): undefined reference to `TagLib::FileRef::~FileRef()'
minbsp.cpp:(.text+0xdd): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xee): undefined reference to `TagLib::String::~String()'
minbsp.cpp:(.text+0xff): undefined reference to `TagLib::FileRef::~FileRef()'
collect2: ld gab 1 als Ende-Status zurück
</code></pre>
<p>Ich übergebe dem g++ den Pfad zur Bilbiothek (/usr/local/lib), dort ist die Bilbiohtek auch vorhanden (<a href="http://libtag.so" rel="nofollow">libtag.so</a>). Wieso findet er die Bilbiothek nicht? Und wieso beschwert sich der Linker überhaupt, schließlich möchte ich die Bilbiothek ja dynamsich (und nicht statisch) linken. D.h. er müsste doch eigentlich erst zur Laufzeit meckern...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2338067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2338067</guid><dc:creator><![CDATA[LD]]></dc:creator><pubDate>Wed, 10 Jul 2013 20:57:41 GMT</pubDate></item><item><title><![CDATA[Reply to dynamisches Linken einer Bibliothek on Wed, 10 Jul 2013 21:42:18 GMT]]></title><description><![CDATA[<blockquote>
<p>D.h. er müsste doch eigentlich erst zur Laufzeit meckern...</p>
</blockquote>
<p>Nein. Er muss die Namen trotzdem aufloesen. Was passiert, wenn -ltag ganz am Ende steht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2338074</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2338074</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Wed, 10 Jul 2013 21:42:18 GMT</pubDate></item><item><title><![CDATA[Reply to dynamisches Linken einer Bibliothek on Wed, 10 Jul 2013 21:51:20 GMT]]></title><description><![CDATA[<p>Danke knivil! soviel zeit für dieses Problem verschwendet und dann liegt es an sowas... Was macht das für einen unterschied wenn das -ltag hinten steht? Linkt der g++ dann anders?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2338077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2338077</guid><dc:creator><![CDATA[LD]]></dc:creator><pubDate>Wed, 10 Jul 2013 21:51:20 GMT</pubDate></item><item><title><![CDATA[Reply to dynamisches Linken einer Bibliothek on Wed, 10 Jul 2013 21:56:36 GMT]]></title><description><![CDATA[<p>LD schrieb:</p>
<blockquote>
<p>Danke knivil! soviel zeit für dieses Problem verschwendet und dann liegt es an sowas... Was macht das für einen unterschied wenn das -ltag hinten steht? Linkt der g++ dann anders?</p>
</blockquote>
<p>Ja. Links müssen die Sachen stehen, die von denen rechts abhängig sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2338080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2338080</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 10 Jul 2013 21:56:36 GMT</pubDate></item><item><title><![CDATA[Reply to dynamisches Linken einer Bibliothek on Wed, 10 Jul 2013 22:06:20 GMT]]></title><description><![CDATA[<p>Danke, wieder was gelernt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2338084</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2338084</guid><dc:creator><![CDATA[LD]]></dc:creator><pubDate>Wed, 10 Jul 2013 22:06:20 GMT</pubDate></item></channel></rss>