<?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[Union]]></title><description><![CDATA[<p>Hallo,</p>
<p>wenn ich folgenden Datentyp definiere</p>
<pre><code class="language-cpp">t.h:
namespace test{
 typedef union
 {
  double f;
  long l;
  struct
  {
    unsigned int mant1 :32;
    unsigned int mant0 :20;
   } atyp;
 } btyp;
}

t.cpp:
namespace test{
 double func(double c){
  btyp b;
  return c;
 }
}
</code></pre>
<p>und packe die Datei t in eine Lib., dann bekomme ich beim Linken der Lib mit<br />
einem Programm ein &quot;undefined reference to `func'&quot;. Woran kann das liegen?</p>
<p>Gruß<br />
Boris</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/152012/union</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 17:50:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/152012.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Jul 2006 19:19:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Union on Sat, 01 Jul 2006 19:20:53 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wenn ich folgenden Datentyp definiere</p>
<pre><code class="language-cpp">t.h:
namespace test{
 typedef union
 {
  double f;
  long l;
  struct
  {
    unsigned int mant1 :32;
    unsigned int mant0 :20;
   } atyp;
 } btyp;
}

t.cpp:
namespace test{
 double func(double c){
  btyp b;
  return c;
 }
}
</code></pre>
<p>und packe die Datei t in eine Lib., dann bekomme ich beim Linken der Lib mit<br />
einem Programm ein &quot;undefined reference to `func'&quot;. Woran kann das liegen?</p>
<p>Gruß<br />
Boris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1089758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089758</guid><dc:creator><![CDATA[hjdt]]></dc:creator><pubDate>Sat, 01 Jul 2006 19:20:53 GMT</pubDate></item><item><title><![CDATA[Reply to Union on Sat, 01 Jul 2006 19:41:25 GMT]]></title><description><![CDATA[<p>Definier die Funktion doch in der Header Datei? Mehr sagt diese Fehlermeldung doch gar nichts aus.</p>
<p>MFG Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1089772</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089772</guid><dc:creator><![CDATA[ChrisFehn3]]></dc:creator><pubDate>Sat, 01 Jul 2006 19:41:25 GMT</pubDate></item><item><title><![CDATA[Reply to Union on Sat, 01 Jul 2006 19:50:12 GMT]]></title><description><![CDATA[<p>Sorry, das habe ich vergessen anzugeben, ändert aber nichts an der Situation. Korrekt sollte es dann so sein</p>
<pre><code class="language-cpp">t.h:
namespace test{
 double func(double);
 typedef union
 {
  double f;
  long l;
  struct
  {
    unsigned int mant1 :32;
    unsigned int mant0 :20;
   } atyp;
 } btyp;
}

t.cpp:
namespace test{
 double func(double c){
  btyp b;
  return c;
 }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1089775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089775</guid><dc:creator><![CDATA[hjdt]]></dc:creator><pubDate>Sat, 01 Jul 2006 19:50:12 GMT</pubDate></item><item><title><![CDATA[Reply to Union on Sat, 01 Jul 2006 20:15:45 GMT]]></title><description><![CDATA[<p>hjdt schrieb:</p>
<blockquote>
<p>Sorry, das habe ich vergessen anzugeben, ändert aber nichts an der Situation. Korrekt sollte es dann so sein</p>
<pre><code class="language-cpp">t.h:
namespace test{
 double func(double);
 typedef union
 {
  double f;
  long l;
  struct
  {
    unsigned int mant1 :32;
    unsigned int mant0 :20;
   } atyp;
 } btyp;
}

t.cpp:
namespace test{
 double func(double c){
  btyp b;
  return c;
 }
}
</code></pre>
</blockquote>
<p>Also das einzige was mir jetzt einfällt dass diesen Fehler produziert ist, wenn man vergisst das cpp file mit zur Bibliothek zu linken<br />
Anders könnte ich mir das gerade nicht erklären.</p>
<p>BR</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1089788</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089788</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Sat, 01 Jul 2006 20:15:45 GMT</pubDate></item><item><title><![CDATA[Reply to Union on Sun, 02 Jul 2006 08:05:53 GMT]]></title><description><![CDATA[<p>Das dachte ich mir auch, aber die die Datei habe ich in die Lib einkompiliert. Nehme ich die Union raus, geht es. Das ist schon sehr eigenartig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1089941</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089941</guid><dc:creator><![CDATA[hjdt]]></dc:creator><pubDate>Sun, 02 Jul 2006 08:05:53 GMT</pubDate></item><item><title><![CDATA[Reply to Union on Sun, 02 Jul 2006 09:14:47 GMT]]></title><description><![CDATA[<p>ISO/IEC 14882:1998 schrieb:</p>
<blockquote>
<p>9.5.2 A union of the form</p>
<p>*union { member-specification };</p>
<p>is called an anonymous union; it defines an unnamed object of unnamed type. The member-specification of an anonymous union shall only define non static data members. [.[i]Note:* nested types and functions cannot be declared within an anonymous union. ] The names of the members of an anonymous union shall be distinct from the names of any other entity in the scope in which the anonymous union is declared. [...]</p>
</blockquote>
<p>Gib' der union mal einen Namen:</p>
<pre><code class="language-cpp">typedef union __btyp {
    double f;
    long l;
    struct {
        unsigned int mant1 :32;
        unsigned int mant0 :20;
   } atyp;
} btyp;
</code></pre>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1089962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1089962</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sun, 02 Jul 2006 09:14:47 GMT</pubDate></item></channel></rss>