<?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[Finde einfach kein Fehler]]></title><description><![CDATA[<p>Guten Tag,</p>
<p>Bin noch sehr in den Anfängen bei C++ und lerne mit hilfe von Video2Brain .<br />
Hat bisher alles geklappt nun jetzt bin ich bei dem Thema OBjekte im Heap.<br />
so habe ich auch Verstanden nur anscheind muss irgentwo ein Fehler drin sein..</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

// Klasse Person

class Person
{

      // Eigenschaften

      public:
             string vorname;
             string name; 

      // Funktionen

                   // INstruktor                   
              Person(string v, string n) ;

                   // Destruktor                   
              ~Person() ;              
              string getName() ;
} ;

Person::Person(string v, string n) :
                      vorname(v),
                      name(n)
{ } ;

Person::~Person()
{
                 cout &lt;&lt; &quot; Profil wurde geschlossen ( &quot; &lt;&lt; getName() &lt;&lt; &quot; ) &quot; &lt;&lt; endl;
} ;

string getName()
{
       return vorname + &quot; &quot; name ;       
} ;

using namespace std;

int main(int argc, char *argv[])
{

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>SO den ersten Fehler zeigt er an die Zeile wo steht string vorname;</p>
<p>Hm er meint im Compiler Log:<br />
13 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `string' does not name a type</p>
<p>Das versteh ich schon nicht ich habe ja die String klasse oben mit eingebunden..<br />
Dieser Fehler kommt öfter bei mir. Nur andere Zeilen</p>
<p>So ein Fehler kommt auch öfter:<br />
19 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp expected `)' before &quot;v&quot;</p>
<p>Dann ein andere Fehler ist auch noch:<br />
33 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `cout' undeclared (first use this function)<br />
Hm habe iostream includet.. Drotzdem geht es nicht. ALso dachte ich mir vlt das der Compile evt. kaputt ist ich machte ein Neues Projekt und schrieb einfach mal ein kleines Hello World mit Cout und Strings.. Hat geklappt.</p>
<p>Bitte helft mir ich finde einfach den Fehler nicht.</p>
<p>Compiler Log:</p>
<pre><code>Compiler: Default compiler
Building Makefile: &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot;
Führt  make... aus
make.exe -f &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot; all
g++.exe -c main.cpp -o main.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot;  -I&quot;C:/Dev-Cpp/include&quot;   

main.cpp:13: error: `string' does not name a type
main.cpp:14: error: `string' does not name a type
main.cpp:19: error: expected `)' before &quot;v&quot;

main.cpp:23: error: `string' does not name a type
main.cpp:26: error: expected `)' before &quot;v&quot;

main.cpp:26: error: expected `,' or `;' before &quot;v&quot;
main.cpp: In destructor `Person::~Person()':
main.cpp:33: error: `cout' undeclared (first use this function)
main.cpp:33: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:33: error: `getName' undeclared (first use this function)

main.cpp:33: error: `endl' undeclared (first use this function)
main.cpp: At global scope:
main.cpp:36: error: `string' does not name a type

make.exe: *** [main.o] Error 1

Ausführung beendet
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/216432/finde-einfach-kein-fehler</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 10:51:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/216432.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Jun 2008 07:27:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 07:27:42 GMT]]></title><description><![CDATA[<p>Guten Tag,</p>
<p>Bin noch sehr in den Anfängen bei C++ und lerne mit hilfe von Video2Brain .<br />
Hat bisher alles geklappt nun jetzt bin ich bei dem Thema OBjekte im Heap.<br />
so habe ich auch Verstanden nur anscheind muss irgentwo ein Fehler drin sein..</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

// Klasse Person

class Person
{

      // Eigenschaften

      public:
             string vorname;
             string name; 

      // Funktionen

                   // INstruktor                   
              Person(string v, string n) ;

                   // Destruktor                   
              ~Person() ;              
              string getName() ;
} ;

Person::Person(string v, string n) :
                      vorname(v),
                      name(n)
{ } ;

Person::~Person()
{
                 cout &lt;&lt; &quot; Profil wurde geschlossen ( &quot; &lt;&lt; getName() &lt;&lt; &quot; ) &quot; &lt;&lt; endl;
} ;

string getName()
{
       return vorname + &quot; &quot; name ;       
} ;

using namespace std;

int main(int argc, char *argv[])
{

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>SO den ersten Fehler zeigt er an die Zeile wo steht string vorname;</p>
<p>Hm er meint im Compiler Log:<br />
13 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `string' does not name a type</p>
<p>Das versteh ich schon nicht ich habe ja die String klasse oben mit eingebunden..<br />
Dieser Fehler kommt öfter bei mir. Nur andere Zeilen</p>
<p>So ein Fehler kommt auch öfter:<br />
19 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp expected `)' before &quot;v&quot;</p>
<p>Dann ein andere Fehler ist auch noch:<br />
33 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `cout' undeclared (first use this function)<br />
Hm habe iostream includet.. Drotzdem geht es nicht. ALso dachte ich mir vlt das der Compile evt. kaputt ist ich machte ein Neues Projekt und schrieb einfach mal ein kleines Hello World mit Cout und Strings.. Hat geklappt.</p>
<p>Bitte helft mir ich finde einfach den Fehler nicht.</p>
<p>Compiler Log:</p>
<pre><code>Compiler: Default compiler
Building Makefile: &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot;
Führt  make... aus
make.exe -f &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot; all
g++.exe -c main.cpp -o main.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot;  -I&quot;C:/Dev-Cpp/include&quot;   

main.cpp:13: error: `string' does not name a type
main.cpp:14: error: `string' does not name a type
main.cpp:19: error: expected `)' before &quot;v&quot;

main.cpp:23: error: `string' does not name a type
main.cpp:26: error: expected `)' before &quot;v&quot;

main.cpp:26: error: expected `,' or `;' before &quot;v&quot;
main.cpp: In destructor `Person::~Person()':
main.cpp:33: error: `cout' undeclared (first use this function)
main.cpp:33: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:33: error: `getName' undeclared (first use this function)

main.cpp:33: error: `endl' undeclared (first use this function)
main.cpp: At global scope:
main.cpp:36: error: `string' does not name a type

make.exe: *** [main.o] Error 1

Ausführung beendet
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1534554</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534554</guid><dc:creator><![CDATA[chea77er]]></dc:creator><pubDate>Tue, 24 Jun 2008 07:27:42 GMT</pubDate></item><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 07:34:46 GMT]]></title><description><![CDATA[<p>using namespace std; früher ansetzen.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534563</guid><dc:creator><![CDATA[ceplusplus*loggedoff]]></dc:creator><pubDate>Tue, 24 Jun 2008 07:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 07:35:08 GMT]]></title><description><![CDATA[<p>chea77er schrieb:</p>
<blockquote>
<p>Guten Tag,</p>
<p>Bin noch sehr in den Anfängen bei C++ und lerne mit hilfe von Video2Brain .<br />
Hat bisher alles geklappt nun jetzt bin ich bei dem Thema OBjekte im Heap.<br />
so habe ich auch Verstanden nur anscheind muss irgentwo ein Fehler drin sein..</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

// Klasse Person

class Person
{
      
      // Eigenschaften
      
      public:
             string vorname;
             string name; 
                 
      // Funktionen
      
                   // INstruktor                   
              Person(string v, string n) ;
              
                   // Destruktor                   
              ~Person() ;              
              string getName() ;
} ;

Person::Person(string v, string n) :
                      vorname(v),
                      name(n)
{ } ;

Person::~Person()
{
                 cout &lt;&lt; &quot; Profil wurde geschlossen ( &quot; &lt;&lt; getName() &lt;&lt; &quot; ) &quot; &lt;&lt; endl;
} ;

string getName()
{
       return vorname + &quot; &quot; name ;       
} ;

using namespace std;

int main(int argc, char *argv[])
{
    
    
    
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>SO den ersten Fehler zeigt er an die Zeile wo steht string vorname;</p>
<p>Hm er meint im Compiler Log:<br />
13 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `string' does not name a type</p>
<p>Das versteh ich schon nicht ich habe ja die String klasse oben mit eingebunden..<br />
Dieser Fehler kommt öfter bei mir. Nur andere Zeilen</p>
<p>So ein Fehler kommt auch öfter:<br />
19 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp expected `)' before &quot;v&quot;</p>
<p>Dann ein andere Fehler ist auch noch:<br />
33 C:\Users\René\C++ FIles\Tutorial\HeapObjekte\main.cpp `cout' undeclared (first use this function)<br />
Hm habe iostream includet.. Drotzdem geht es nicht. ALso dachte ich mir vlt das der Compile evt. kaputt ist ich machte ein Neues Projekt und schrieb einfach mal ein kleines Hello World mit Cout und Strings.. Hat geklappt.</p>
<p>Bitte helft mir ich finde einfach den Fehler nicht.</p>
<p>Compiler Log:</p>
<pre><code>Compiler: Default compiler
Building Makefile: &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot;
Führt  make... aus
make.exe -f &quot;C:\Users\René\C++ FIles\Tutorial\HeapObjekte\Makefile.win&quot; all
g++.exe -c main.cpp -o main.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot;  -I&quot;C:/Dev-Cpp/include&quot;   

main.cpp:13: error: `string' does not name a type
main.cpp:14: error: `string' does not name a type
main.cpp:19: error: expected `)' before &quot;v&quot;

main.cpp:23: error: `string' does not name a type
main.cpp:26: error: expected `)' before &quot;v&quot;

main.cpp:26: error: expected `,' or `;' before &quot;v&quot;
main.cpp: In destructor `Person::~Person()':
main.cpp:33: error: `cout' undeclared (first use this function)
main.cpp:33: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:33: error: `getName' undeclared (first use this function)

main.cpp:33: error: `endl' undeclared (first use this function)
main.cpp: At global scope:
main.cpp:36: error: `string' does not name a type

make.exe: *** [main.o] Error 1

Ausführung beendet
</code></pre>
</blockquote>
<p>So es heißt erstens Konstruktor und nicht INstruktor <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="😉"
    /> als zweites heißt es nicht nur string sondern</p>
<pre><code class="language-cpp">std::string
</code></pre>
<p>als nächstes musst du das hier</p>
<pre><code class="language-cpp">string getName()
{
       return vorname + &quot; &quot; name ;      
} ;
</code></pre>
<p>in das hier ändern</p>
<pre><code class="language-cpp">std::string Person::getName()
{
       return vorname + &quot; &quot; name ;      
}
</code></pre>
<p>und lass mal die ; nach deinen Methoden weg.</p>
<p>P.S. Kauf dir lieber ein ordentliches Buch, als Video2Brain</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534564</guid><dc:creator><![CDATA[Firefighter]]></dc:creator><pubDate>Tue, 24 Jun 2008 07:35:08 GMT</pubDate></item><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 07:36:40 GMT]]></title><description><![CDATA[<p>ach shi* hab ja gar net gesehen das Using NameSpace std; erst nach den Klasse kommen...</p>
<p>Danke für die schnelle Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534565</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534565</guid><dc:creator><![CDATA[chea77er]]></dc:creator><pubDate>Tue, 24 Jun 2008 07:36:40 GMT</pubDate></item><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 07:42:36 GMT]]></title><description><![CDATA[<p>chea77er schrieb:</p>
<blockquote>
<p>so habe ich auch Verstanden nur anscheind muss irgentwo ein Fehler drin sein..</p>
</blockquote>
<p>Mehrere Anmerkungen:</p>
<pre><code class="language-cpp">// #include &lt;cstdlib&gt; =&gt; Benutzt du nirgendwo, wenn ich es richtig sehe...
#include &lt;iostream&gt;
#include &lt;string&gt;

// Klasse Person
class Person
{
    public:
        // Eigenschaften
        // =&gt; Normalerweise private (Geheimnisprinzip)
        std::string vorname; // string liegt im Namensraum std
        std::string name; 

        // Funktionen
        // Konstruktor
        // =&gt; nicht &quot;INstruktor&quot;
        // =&gt; Objekte besser als &quot;const Reference&quot; als per Wert übergeben
        //    (unnötige Kopien vermeiden)
        // =&gt; sprechende Namen sind hilfreich
        Person(
          std::string const &amp; vorname,
          std::string const &amp; nachname);

        // Destruktor                   
        ~Person();

        // Getter/Setter
        // =&gt; Methoden die keine Werte ändern sollten const deklariert sein
        std::string getName() const;
};

Person::Person(
    std::string const &amp; vorname,
    std::string const &amp; nachname)
:   vorname(vorname),
    name(nachname)
{
} // =&gt; Hier ist kein Semikolon nötig

Person::~Person()
{
    std::cout &lt;&lt; &quot; Profil wurde geschlossen ( &quot;
      &lt;&lt; getName() &lt;&lt; &quot; ) &quot; &lt;&lt; std::endl;
}

std::string getName() const
{
  return vorname + &quot; &quot; + name; // =&gt; Ein + vergessen
}

// =&gt; using namespace std würde die Notwendigkeit der Angabe des
//    Namensraumes entfernen, sollte aber niemals vor includes und
//    niemals im Header stehen. Da normalerweise Klassen in separaten
//    Header/Source-Dateien untergebracht werden, habe ich das nicht
//    nach oben verschoben, um es dir gleich abzugewöhnen!
using namespace std;

// =&gt; Sofern du die Übergabeparameter nicht brauchst, würde
//    ich die einfachere Schreibweise vorziehen, und auch einen
//    Returnwert brauchst du bei der main-Funktion nicht, da diese
//    implizit 0 zurückgibt.
int main()
{
    // =&gt; C/C++ Alternative zu system(&quot;PAUSE&quot;) siehe FAQ (DOS/Konsole),
    //    unter &quot;Automatisches Schließen verhindern&quot;.
    system(&quot;PAUSE&quot;);
}
</code></pre>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534569</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Tue, 24 Jun 2008 07:42:36 GMT</pubDate></item><item><title><![CDATA[Reply to Finde einfach kein Fehler on Tue, 24 Jun 2008 08:34:08 GMT]]></title><description><![CDATA[<p>oh vielen dank asc | André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534594</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534594</guid><dc:creator><![CDATA[chea77er]]></dc:creator><pubDate>Tue, 24 Jun 2008 08:34:08 GMT</pubDate></item></channel></rss>