<?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[undefined reference to...]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Ich habe eines dieser Standardprobleme beim Kompilieren und brauche wirklich dringend Hilfe!!!</p>
<p>Mein Programm umfasst eine Header-Datei PLY.h, eine Datei PLY.cpp und eine main.cpp.</p>
<p>In der Header Datei wird das Objekt PLYObject definiert und in PLY.cpp wird es implementiert.<br />
In der main-Datei habe ich eine Funktion die folgendermassen aussieht:</p>
<p>PLYObject *obj;</p>
<p>void loadPLYObject(char *ply_file_name)<br />
{<br />
obj = new PLYObject(ply_file_name);<br />
}</p>
<p>Nun erhalte ich mit folgendem make-file,<br />
-------------------------------------------------------------------------<br />
CPP = g++<br />
LDLIBS = -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib</p>
<p>.cpp:<br />
$(CPP) $@.cpp $(LDLIBS) -o <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi mathvariant="normal">@</mi><mi mathvariant="normal">#</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi></mrow><annotation encoding="application/x-tex">@  
\# ./</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">@</span><span class="mord mathrm">#</span><span class="mord mathrm">.</span><span class="mord mathrm">/</span></span></span></span>@<br />
-------------------------------------------------------------------------<br />
folgende Fehlermeldung:<br />
-----------------------------------------------------------------------------------<br />
klimawandel@IBMX41:~/Dokumente/Computer Graphics/Lab/ex04/4.2$ make main<br />
#g++ -c main.cpp<br />
# g++ -o main main.cpp -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib<br />
g++ main.cpp -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib -o main<br />
/tmp/ccIz1iVX.o: In function <code>loadPLYObject(char*)': main.cpp:(.text+0x21): undefined reference to</code>PLYObject::PLYObject(char*)'<br />
/tmp/ccIz1iVX.o: In function <code>unloadPLYObject()': main.cpp:(.text+0xd6): undefined reference to</code>PLYObject::~PLYObject()'<br />
collect2: ld gab 1 als Ende-Status zurück<br />
make: *** [main] Fehler 1<br />
-------------------------------------------------------------------------------------------</p>
<p>Ich nehme mal an dass dies ein klassisches Linker-Problem sein wird?!</p>
<p>Oder wie genau muss ich beim Kompilieren dieser Klassen vorgehen?</p>
<p>Ich danke für jede Hilfe...</p>
<p>Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/145923/undefined-reference-to</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 13:16:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/145923.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 May 2006 14:34:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 14:34:30 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Ich habe eines dieser Standardprobleme beim Kompilieren und brauche wirklich dringend Hilfe!!!</p>
<p>Mein Programm umfasst eine Header-Datei PLY.h, eine Datei PLY.cpp und eine main.cpp.</p>
<p>In der Header Datei wird das Objekt PLYObject definiert und in PLY.cpp wird es implementiert.<br />
In der main-Datei habe ich eine Funktion die folgendermassen aussieht:</p>
<p>PLYObject *obj;</p>
<p>void loadPLYObject(char *ply_file_name)<br />
{<br />
obj = new PLYObject(ply_file_name);<br />
}</p>
<p>Nun erhalte ich mit folgendem make-file,<br />
-------------------------------------------------------------------------<br />
CPP = g++<br />
LDLIBS = -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib</p>
<p>.cpp:<br />
$(CPP) $@.cpp $(LDLIBS) -o <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi mathvariant="normal">@</mi><mi mathvariant="normal">#</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi></mrow><annotation encoding="application/x-tex">@  
\# ./</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">@</span><span class="mord mathrm">#</span><span class="mord mathrm">.</span><span class="mord mathrm">/</span></span></span></span>@<br />
-------------------------------------------------------------------------<br />
folgende Fehlermeldung:<br />
-----------------------------------------------------------------------------------<br />
klimawandel@IBMX41:~/Dokumente/Computer Graphics/Lab/ex04/4.2$ make main<br />
#g++ -c main.cpp<br />
# g++ -o main main.cpp -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib<br />
g++ main.cpp -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib -o main<br />
/tmp/ccIz1iVX.o: In function <code>loadPLYObject(char*)': main.cpp:(.text+0x21): undefined reference to</code>PLYObject::PLYObject(char*)'<br />
/tmp/ccIz1iVX.o: In function <code>unloadPLYObject()': main.cpp:(.text+0xd6): undefined reference to</code>PLYObject::~PLYObject()'<br />
collect2: ld gab 1 als Ende-Status zurück<br />
make: *** [main] Fehler 1<br />
-------------------------------------------------------------------------------------------</p>
<p>Ich nehme mal an dass dies ein klassisches Linker-Problem sein wird?!</p>
<p>Oder wie genau muss ich beim Kompilieren dieser Klassen vorgehen?</p>
<p>Ich danke für jede Hilfe...</p>
<p>Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049615</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049615</guid><dc:creator><![CDATA[klimawandel]]></dc:creator><pubDate>Tue, 02 May 2006 14:34:30 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 14:36:56 GMT]]></title><description><![CDATA[<p>Warum combilierst du deine anderen Dateien nicht mit?<br />
Also PLY.cpp...<br />
Wenns dann nciht geht musst du mal etwas code posten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049618</guid><dc:creator><![CDATA[Mario Sandler]]></dc:creator><pubDate>Tue, 02 May 2006 14:36:56 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 14:48:02 GMT]]></title><description><![CDATA[<p>Ich habe die PLY.cpp auch kompiliert und gelinkt und anschliessend dasselbe mit der main.cpp gemacht und erhalte trotzdem diese Fehlermeldung.</p>
<p>Oder muss ich die PLY.h und PLY.cpp (wo ja eben das PLYObject definiert und implementiert wird) irgendwo angeben in der make-datei, damit main.cpp diese Klasse findet?!</p>
<p>Ich würde gerne Code posten, aber leider ist es unheimlich viel...<br />
...schade kann man keine files uploaden...</p>
<p>gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049633</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049633</guid><dc:creator><![CDATA[klimawandel]]></dc:creator><pubDate>Tue, 02 May 2006 14:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 14:54:29 GMT]]></title><description><![CDATA[<p>Dein Output sagt eindeutig dass ins Executable nur die main.o gelinkt wird. Dort müssen alle vorher compilierten Objekte gelinkt werden.</p>
<p>BTW:<br />
Wenn Du Code postest sollst Du auch nicht &quot;unheimlich viel&quot; posten sondern ein Minimalbeispiel, welches den Fehler aufzeigt. Oder glaubst Du wir arbeiten uns in ein mittelgroßes Projekt ein um einen Anfänger- (sorry) Fehler zu beheben? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>EDIT:<br />
Dein Output sagt sogar dass Du erst main.cpp nach main.o compilierst, und dann main.cpp nach main. Es wäre sinnvoller, main.o (und die anderen) nach main zu compilieren (linken).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049641</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049641</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Tue, 02 May 2006 14:54:29 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 15:18:23 GMT]]></title><description><![CDATA[<p>Was er damit sagen will:</p>
<pre><code>g++ -c -o main.o main.cpp
g++ -c -o PLY.o PLY.cpp
g++ -o main main.o PLY.o -lglut -lGL -lGLU -lX11 -lm -L/usr/X11R6/lib
</code></pre>
<p>Das ganze kannst du natürlich auch geschickt in eine makefiel verpacken.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049664</guid><dc:creator><![CDATA[Mario Sandler]]></dc:creator><pubDate>Tue, 02 May 2006 15:18:23 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 15:18:42 GMT]]></title><description><![CDATA[<p>Na gut, ich versuche mal mein Problem-Code &quot;zusammenzufassen&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /><br />
aber das ding ist ja dass ich den code nicht selbst geschrieben habe und er lauffähig sein sollte. es liegt nur an mir dass ich nicht in der lage bin den code zu kompilieren bzw. zu linken.</p>
<p>PLY.h</p>
<pre><code>#ifndef PLY_H
#define PLY_H

class PLYObject {
public:

  PLYObject(char *plyfile);
  ~PLYObject();
 ...
}
#endif
</code></pre>
<p>PLY.cpp</p>
<pre><code>#include &quot;PLY.h&quot;

PLYObject::PLYObject(char *plyfile){
...bla bla bla...
}

PLYObject::~PLYObject()
{
 ...
}
</code></pre>
<p>main.cpp</p>
<pre><code>void loadPLYObject(char *ply_file_name)
{
	obj = new PLYObject(ply_file_name);
        ...
}
</code></pre>
<p>Ich weiss dass dieser code-ausschnitt euch nicht viel weiter bringt, aber so in etwa ist das programm aufgebaut.</p>
<p>Da ich, wie ihr bereits erkannt habt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /> , ein Anfänger bin, wäre ich froh wenn Ihr Mir vielleicht konkret sagen könnten wie der compilier-befehl danach aussehen würde...</p>
<p>Vielen danke aber schon mal für eure hilfe...</p>
<p>Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049665</guid><dc:creator><![CDATA[klimawandel]]></dc:creator><pubDate>Tue, 02 May 2006 15:18:42 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to... on Tue, 02 May 2006 15:23:49 GMT]]></title><description><![CDATA[<p>WUNDERBAR !!!</p>
<p>Das Problem hat sich gelöst!<br />
Danke viel mal für Eure Beiträge...!<br />
Jetz verstehe ich das Konzept...</p>
<p>Vielen Dank nochmals...</p>
<p>Freundliche Grüsse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049671</guid><dc:creator><![CDATA[klimawandel]]></dc:creator><pubDate>Tue, 02 May 2006 15:23:49 GMT</pubDate></item></channel></rss>