<?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]]></title><description><![CDATA[<p>Hi,</p>
<p>mache gerade seit langem mal wieder was mit C++ und bin echt verzweifelt :P.</p>
<p>Ich bekomme beim Erstellen einer Klasse immer eine undefined reference to `MatlabDevice::MatlabDevice()' um die Ohren geschmissen und weiß nicht wieso. Hier mal der Code:</p>
<pre><code class="language-cpp">#include &quot;DeviceTest.hpp&quot;

DeviceTest::DeviceTest() {
	device = new MatlabDevice();
}
</code></pre>
<p>Hier der Code von DeviceTest.hpp:</p>
<pre><code class="language-cpp">#ifndef DEVICETEST_HPP_
#define DEVICETEST_HPP_

#include &quot;MatlabDevice.hpp&quot;

class DeviceTest {
public:
	DeviceTest();
	~DeviceTest();

	void basicTest();

private:
	MatlabDevice* device;

};

#endif
</code></pre>
<p>Die Klasse MatlabDevice ist auch eine stinknormale Klasse:</p>
<pre><code class="language-cpp">/*
 * MatlabDevice.hpp
 *
 *  Created on: 29.05.2012
 *      Author: simon
 */

#ifndef __MATLAB_DEVICE_H
#define __MATLAB_DEVICE_H

#include &quot;IDevice.hpp&quot;
#include &lt;inttypes.h&gt;
#include &lt;vector&gt;
#include &lt;engine.h&gt;
#include &quot;MatlabAPI.hpp&quot;

class MatlabDevice : public IDevice {

  public:

    MatlabDevice();

    ~MatlabDevice();

    bool connect(IBackend &amp;backend);

    bool receiveProcessData(size_t deviceDomainId);

    bool sendProcessData(size_t MatlabDeviceDomainId);

    bool setupFinished();

    // device specific methods

    std::vector&lt;double&gt; getSystemVoltages();

    std::vector&lt;uint64_t&gt; getTimestamps();

    std::vector&lt;double&gt; getJointAngles(std::vector&lt;double&gt; inJointOffsets);

    std::vector&lt;double&gt; getMotorAngles(std::vector&lt;double&gt; inMotorOffsets);

    std::vector&lt;double&gt; getMotorCurrents();

    double calculateSpringLength(int jointIndex, double jointAngle, double motorAngle);

    std::vector&lt;double&gt; getSpringLengths(std::vector&lt;double&gt; jointAngles, std::vector&lt;double&gt; motorAngles);

    std::vector&lt;double&gt; getHallSensorData(std::vector&lt;double&gt; inHallOffsets);

    std::vector&lt;double&gt; getForceSensorData();

    std::vector&lt;double&gt; getGyroData();

    std::vector&lt;double&gt; getAccData();

    void enableMotorControl(bool enable);

    void setMotorVoltages(const std::vector&lt;double&gt; &amp;desiredMotorVoltages, const std::vector&lt;double&gt; &amp;systemVoltages);

  private:
    MatlabAPI* matlab;
    bool simulationStarted;

};

enum EnumMatlabDeviceDomainIds {
  ReadWriteDomain
};

#endif /* DEVICE_HPP_ */
</code></pre>
<p>Kann sich das jemand erklären? Habe ich irgendwas extrem einfaches übersehen oder liegt das am Compiler?! Ich sehe da keinen Fehler <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/306604/undefined-reference</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 16:40:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/306604.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Aug 2012 13:56:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 13:56:59 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>mache gerade seit langem mal wieder was mit C++ und bin echt verzweifelt :P.</p>
<p>Ich bekomme beim Erstellen einer Klasse immer eine undefined reference to `MatlabDevice::MatlabDevice()' um die Ohren geschmissen und weiß nicht wieso. Hier mal der Code:</p>
<pre><code class="language-cpp">#include &quot;DeviceTest.hpp&quot;

DeviceTest::DeviceTest() {
	device = new MatlabDevice();
}
</code></pre>
<p>Hier der Code von DeviceTest.hpp:</p>
<pre><code class="language-cpp">#ifndef DEVICETEST_HPP_
#define DEVICETEST_HPP_

#include &quot;MatlabDevice.hpp&quot;

class DeviceTest {
public:
	DeviceTest();
	~DeviceTest();

	void basicTest();

private:
	MatlabDevice* device;

};

#endif
</code></pre>
<p>Die Klasse MatlabDevice ist auch eine stinknormale Klasse:</p>
<pre><code class="language-cpp">/*
 * MatlabDevice.hpp
 *
 *  Created on: 29.05.2012
 *      Author: simon
 */

#ifndef __MATLAB_DEVICE_H
#define __MATLAB_DEVICE_H

#include &quot;IDevice.hpp&quot;
#include &lt;inttypes.h&gt;
#include &lt;vector&gt;
#include &lt;engine.h&gt;
#include &quot;MatlabAPI.hpp&quot;

class MatlabDevice : public IDevice {

  public:

    MatlabDevice();

    ~MatlabDevice();

    bool connect(IBackend &amp;backend);

    bool receiveProcessData(size_t deviceDomainId);

    bool sendProcessData(size_t MatlabDeviceDomainId);

    bool setupFinished();

    // device specific methods

    std::vector&lt;double&gt; getSystemVoltages();

    std::vector&lt;uint64_t&gt; getTimestamps();

    std::vector&lt;double&gt; getJointAngles(std::vector&lt;double&gt; inJointOffsets);

    std::vector&lt;double&gt; getMotorAngles(std::vector&lt;double&gt; inMotorOffsets);

    std::vector&lt;double&gt; getMotorCurrents();

    double calculateSpringLength(int jointIndex, double jointAngle, double motorAngle);

    std::vector&lt;double&gt; getSpringLengths(std::vector&lt;double&gt; jointAngles, std::vector&lt;double&gt; motorAngles);

    std::vector&lt;double&gt; getHallSensorData(std::vector&lt;double&gt; inHallOffsets);

    std::vector&lt;double&gt; getForceSensorData();

    std::vector&lt;double&gt; getGyroData();

    std::vector&lt;double&gt; getAccData();

    void enableMotorControl(bool enable);

    void setMotorVoltages(const std::vector&lt;double&gt; &amp;desiredMotorVoltages, const std::vector&lt;double&gt; &amp;systemVoltages);

  private:
    MatlabAPI* matlab;
    bool simulationStarted;

};

enum EnumMatlabDeviceDomainIds {
  ReadWriteDomain
};

#endif /* DEVICE_HPP_ */
</code></pre>
<p>Kann sich das jemand erklären? Habe ich irgendwas extrem einfaches übersehen oder liegt das am Compiler?! Ich sehe da keinen Fehler <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237934</guid><dc:creator><![CDATA[mikemodanoxxx]]></dc:creator><pubDate>Thu, 02 Aug 2012 13:56:59 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:01:42 GMT]]></title><description><![CDATA[<p>Dir (bzw. dem Linker) fehlt die Implementation der Klasse. Du brauchst noch die zugehörige .cpp oder .lib.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237936</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:01:42 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:06:44 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">device = new MatlabDevice;
</code></pre>
<p>ohne Klammern</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237941</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237941</guid><dc:creator><![CDATA[gastgast]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:06:44 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:07:15 GMT]]></title><description><![CDATA[<p>gastgast schrieb:</p>
<blockquote>
<pre><code class="language-cpp">device = new MatlabDevice;
</code></pre>
<p>ohne Klammern</p>
</blockquote>
<p>Ohne new.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237942</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:07:15 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:09:11 GMT]]></title><description><![CDATA[<p>ohne Zuweisung :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237944</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237944</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:09:11 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:13:07 GMT]]></title><description><![CDATA[<p>_matze schrieb:</p>
<blockquote>
<p>Dir (bzw. dem Linker) fehlt die Implementation der Klasse. Du brauchst noch die zugehörige .cpp oder .lib.</p>
</blockquote>
<p>Wieso klappt das dann bei allen anderen Klassen? Ich benutze Eclipse CDT. Beim Linker steht nur:</p>
<pre><code class="language-cpp">${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
</code></pre>
<p>Normalerweise muss man da ja gar nichts einstellen?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237948</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237948</guid><dc:creator><![CDATA[mikemodanoxxx]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:13:07 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:14:42 GMT]]></title><description><![CDATA[<p>Ist möglicherweise vergessen worden, den Defaultkonstruktor von MatlabDevice irgendwo zu implementieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237950</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:14:42 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:22:10 GMT]]></title><description><![CDATA[<p>Oh ja, danke :). Ich dachte wenn der leer ist muss man den nicht implementieren wie in Java..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237960</guid><dc:creator><![CDATA[mikemodanoxxx]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:22:10 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:23:47 GMT]]></title><description><![CDATA[<p>Warum deklarierst du ihn ueberhaupt, wenn er leer ist? Warum den Dtor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237961</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:23:47 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:35:44 GMT]]></title><description><![CDATA[<p>Hm ja hab die standardmäßig so drin.. bin ich irgendwie so gewöhnt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237975</guid><dc:creator><![CDATA[mikemodanoxxx]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:35:44 GMT</pubDate></item><item><title><![CDATA[Reply to Undefined Reference on Thu, 02 Aug 2012 14:39:29 GMT]]></title><description><![CDATA[<p>mikemodanoxxx schrieb:</p>
<blockquote>
<p>bin ich irgendwie so gewöhnt.</p>
</blockquote>
<p>Abgewöhnen <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="🙂"
    /> Nichts deklarieren, was du nicht brauchst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2237977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2237977</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 02 Aug 2012 14:39:29 GMT</pubDate></item></channel></rss>