<?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[error: &#x27;name&#x27; was not declared in this scope]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich weiß nicht wer von euch Omnet++ kennt. Aber ich versuche da gerade das tictoc tutorial nach zu programmieren und bekommen beim Aufruf von make den Fehler:</p>
<pre><code>In member function ‘virtual void Txc1::initialize()’:
error: 'name' was not declared in this scope
</code></pre>
<p>.<br />
Die Funktion die das Aufruft sieht wie folgt aus:</p>
<pre><code>void Txc1::initialize()
{
    // Initialize is called at the beginning of the simulation.
    // To bootstrap the tic-toc-tic-toc process, one of the modules needs
    // to send the first message. Let this be `tic'.

    // Am I Tic or Toc?
    if (strcmp(&quot;tic&quot;, name()) == 0)
    {
        // create and send first message on gate &quot;out&quot;. &quot;tictocMsg&quot; is an
        // arbitrary string which will be the name of the message object.
        cMessage *msg = new cMessage(&quot;tictocMsg&quot;);
        send(msg, &quot;out&quot;);
    }
}
</code></pre>
<p>Kann mir da jemand weiter helfen?</p>
<p>Da ich kein C++ Coder bin, noch einige Fragen dazu:<br />
ist 'name()' eine C++ Funktion oder sollte das die Funktion der Klasse sein aus der auch das 'tic' Objekt ist? In diesem Fall die Txc1, oder die Oberklasse.</p>
<p>Vielen Danke,<br />
Korko</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/232236/error-name-was-not-declared-in-this-scope</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 09:46:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/232236.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jan 2009 16:26:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error: &#x27;name&#x27; was not declared in this scope on Tue, 20 Jan 2009 16:30:40 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich weiß nicht wer von euch Omnet++ kennt. Aber ich versuche da gerade das tictoc tutorial nach zu programmieren und bekommen beim Aufruf von make den Fehler:</p>
<pre><code>In member function ‘virtual void Txc1::initialize()’:
error: 'name' was not declared in this scope
</code></pre>
<p>.<br />
Die Funktion die das Aufruft sieht wie folgt aus:</p>
<pre><code>void Txc1::initialize()
{
    // Initialize is called at the beginning of the simulation.
    // To bootstrap the tic-toc-tic-toc process, one of the modules needs
    // to send the first message. Let this be `tic'.

    // Am I Tic or Toc?
    if (strcmp(&quot;tic&quot;, name()) == 0)
    {
        // create and send first message on gate &quot;out&quot;. &quot;tictocMsg&quot; is an
        // arbitrary string which will be the name of the message object.
        cMessage *msg = new cMessage(&quot;tictocMsg&quot;);
        send(msg, &quot;out&quot;);
    }
}
</code></pre>
<p>Kann mir da jemand weiter helfen?</p>
<p>Da ich kein C++ Coder bin, noch einige Fragen dazu:<br />
ist 'name()' eine C++ Funktion oder sollte das die Funktion der Klasse sein aus der auch das 'tic' Objekt ist? In diesem Fall die Txc1, oder die Oberklasse.</p>
<p>Vielen Danke,<br />
Korko</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1649013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1649013</guid><dc:creator><![CDATA[Korko]]></dc:creator><pubDate>Tue, 20 Jan 2009 16:30:40 GMT</pubDate></item><item><title><![CDATA[Reply to error: &#x27;name&#x27; was not declared in this scope on Tue, 20 Jan 2009 16:42:58 GMT]]></title><description><![CDATA[<p>Der Fehler ist ja recht aussagekräftig: Der Bezeichner wurde nicht deklariert.</p>
<p><code>name()</code> ist keine freie Funktion der Standardbibliothek. Falls sie eine Memberfunktion aus deinem Framework ist, musst du noch die Instanz - oder bei statischen Memberfunktionen die Klasse - angeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1649023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1649023</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 20 Jan 2009 16:42:58 GMT</pubDate></item><item><title><![CDATA[Reply to error: &#x27;name&#x27; was not declared in this scope on Tue, 20 Jan 2009 17:00:48 GMT]]></title><description><![CDATA[<p>Also irgendwie hilft mir die Antwort leider nicht weiter. Wie gesagt es handelt sich hierbei um ein Tutorial, also glaube ich nicht das an dem Code falsch ist. Ich würde eher auf meine Umgebung tippen.<br />
Der gesamte Code der Klasse/Datei sieht so aus:</p>
<pre><code>#include &lt;string.h&gt;
#include &lt;omnetpp.h&gt;

class Txc1 : public cSimpleModule
{
  protected:
    // The following redefined virtual function holds the algorithm.
    virtual void initialize();
    virtual void handleMessage(cMessage *msg);
};

// The module class needs to be registered with OMNeT++
Define_Module(Txc1);

void Txc1::initialize()
{
    // Initialize is called at the beginning of the simulation.
    // To bootstrap the tic-toc-tic-toc process, one of the modules needs
    // to send the first message. Let this be `tic'.

    // Am I Tic or Toc?
    if (strcmp(&quot;tic&quot;, name()) == 0)
    {
        // create and send first message on gate &quot;out&quot;. &quot;tictocMsg&quot; is an
        // arbitrary string which will be the name of the message object.
        cMessage *msg = new cMessage(&quot;tictocMsg&quot;);
        send(msg, &quot;out&quot;);
    }
}

void Txc1::handleMessage(cMessage *msg)
{
    // The handleMessage() method is called whenever a message arrives
    // at the module. Here, we just send it to the other module, through
    // gate `out'. Because both `tic' and `toc' does the same, the message
    // will bounce between the two.
    send(msg, &quot;out&quot;);
}
</code></pre>
<p>Zum Programm gehört noch eine .ned Datei in der das omnet Netzwerk definiert wird und die sieht so aus (aus Vollständigkeits Gründen):</p>
<pre><code>simple [b]Txc1[/b]
    gates:
        in: in;
        out: out;
endsimple

//
// Two instances (tic and toc) of Txc1 connected both ways.
// Tic and toc will pass messages to one another.
//
module Tictoc1
    submodules:
        tic: Txc1;
        toc: Txc1;
    connections:
        tic.out --&gt; delay 100ms --&gt; toc.in;
        tic.in &lt;-- delay 100ms &lt;-- toc.out;
endmodule

network tictoc1 : Tictoc1
endnetwork
</code></pre>
<p>Das ist natürlich kein C Code, aber das 'Txc1' Modul wird in C++ programmiert und dort tritt halt der beschriebene Fehler auf.</p>
<p>Gruß &amp; Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1649041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1649041</guid><dc:creator><![CDATA[Korko]]></dc:creator><pubDate>Tue, 20 Jan 2009 17:00:48 GMT</pubDate></item><item><title><![CDATA[Reply to error: &#x27;name&#x27; was not declared in this scope on Tue, 20 Jan 2009 17:49:56 GMT]]></title><description><![CDATA[<p>name() muss entweder eine freie Funktion (hier unwahrscheinlich) oder eine Memberfunktion deiner Klasse (nein) oder deren Basisklasse (möglich) sein.<br />
Irgendwo muss diese Funktion deklariert sein und das ist nicht in der Standardbibliothek.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1649074</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1649074</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 20 Jan 2009 17:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to error: &#x27;name&#x27; was not declared in this scope on Tue, 20 Jan 2009 17:55:00 GMT]]></title><description><![CDATA[<p>Hallo und danke für eure Hilfe,</p>
<p>leider ist tas Tutorial falsch. Die Funktion heist nicht name() sondern getName().</p>
<p>Bis dann,<br />
Korko</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1649076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1649076</guid><dc:creator><![CDATA[Korko]]></dc:creator><pubDate>Tue, 20 Jan 2009 17:55:00 GMT</pubDate></item></channel></rss>