<?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[Strukturen und Strings]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich bin gerade dabei mich ein bißchen in c++ reinzuarbeiten. Nun versuche ich Strings zu deklarieren:</p>
<pre><code>#include &lt;string.h&gt;
struct options
{
	string name;
	char *type;
	int defaultVal;
	char *help;
	char *verify;
};
</code></pre>
<p>Allerdings gibt es einen Compilerfehler beim übersetzen:</p>
<blockquote>
<p>parse error before `string'</p>
</blockquote>
<p>Und ich weiß nicht warum. Ich hoffe mir kann jemand helfen.</p>
<p>Dann habe ich noch ein zweites Problem. Ich versuche innerhalb einer Struktur eine Variable anzulegen, deren Datentyp wieder eine Struktur ist. Also ich habe eine Struktur (siehe oben) und dann versuche ich folgende Struktur anzulegen:</p>
<pre><code>struct driverparam
{
	char *name;
	options paramOptions;
};
</code></pre>
<p>Auch dort gibt es einen Compilerfehler:</p>
<blockquote>
<p>parse error before `options'</p>
</blockquote>
<p>Auch hier hoff ich auch eure Hilfe. Vielen Dank schon einmal im Voraus.</p>
<p>mfg chuqa</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/152124/strukturen-und-strings</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 21:48:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/152124.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Jul 2006 09:20:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:20:37 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich bin gerade dabei mich ein bißchen in c++ reinzuarbeiten. Nun versuche ich Strings zu deklarieren:</p>
<pre><code>#include &lt;string.h&gt;
struct options
{
	string name;
	char *type;
	int defaultVal;
	char *help;
	char *verify;
};
</code></pre>
<p>Allerdings gibt es einen Compilerfehler beim übersetzen:</p>
<blockquote>
<p>parse error before `string'</p>
</blockquote>
<p>Und ich weiß nicht warum. Ich hoffe mir kann jemand helfen.</p>
<p>Dann habe ich noch ein zweites Problem. Ich versuche innerhalb einer Struktur eine Variable anzulegen, deren Datentyp wieder eine Struktur ist. Also ich habe eine Struktur (siehe oben) und dann versuche ich folgende Struktur anzulegen:</p>
<pre><code>struct driverparam
{
	char *name;
	options paramOptions;
};
</code></pre>
<p>Auch dort gibt es einen Compilerfehler:</p>
<blockquote>
<p>parse error before `options'</p>
</blockquote>
<p>Auch hier hoff ich auch eure Hilfe. Vielen Dank schon einmal im Voraus.</p>
<p>mfg chuqa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090565</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090565</guid><dc:creator><![CDATA[Chuqa]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:20:37 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:26:19 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string.h&gt;
#include &lt;iostream&gt;
struct options
{
    ::std::string name;
    char *type;
    int defaultVal;
    char *help;
    char *verify;
};

struct driverparam
{
    char *name;
    options paramOptions;
};

int main(){
}
</code></pre>
<p>Funktioniert bei mir..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090569</guid><dc:creator><![CDATA[...............]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:26:19 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:26:27 GMT]]></title><description><![CDATA[<p>Chuqa schrieb:</p>
<blockquote>
<pre><code>#include &lt;string.h&gt;
struct options
{
	string name;
	char *type;
	int defaultVal;
	char *help;
	char *verify;
};
</code></pre>
</blockquote>
<p>Also bei mir ging es als ich es so abgeändert habe:</p>
<pre><code class="language-cpp">#include &lt;string&gt; // &lt;string.h&gt; ist veraltet -&gt; nicht mehr benutzen
struct options
{
	std::string name; //namespace (std) angeben
	char *type;
	int defaultVal;
	char *help;
	char *verify;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1090570</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090570</guid><dc:creator><![CDATA[Chris++ 0]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:26:27 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:30:35 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich glaube du suchst das:</p>
<pre><code class="language-cpp">#include &lt;string.h&gt;
#include &lt;iostream&gt;
using namespace std;
struct options
{
    ::std::string name;
    char *type;
    int defaultVal;
    char *help;
    char *verify;
};

struct driverparam : options
{
    char *name;
    options paramOptions;
};

int main(){
    driverparam b;
    b.defaultVal = 2;
    ::std::cout &lt;&lt; b.defaultVal;
}
</code></pre>
<p>MFG winexec*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090573</guid><dc:creator><![CDATA[winexec*]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:30:35 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:40:15 GMT]]></title><description><![CDATA[<p>string.h ist ein ANSI-C Headerfile, welches die Funktionen strcpy usw. definiert. Die heisst aber in C++ cstring.</p>
<p>Also um jetzt mal alles richtige zusammenzusammeln und alles falsche zu kürzen, so muss es sein (Anmerkung: ohne using, mit std::, beides zusammen ist überflüssig und :: vor dem std erst recht <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>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

struct options
{
    std::string name;
    char *type;
    int defaultVal;
    char *help;
    char *verify;
};

struct driverparam
{
    char *name;
    options paramOptions;
};

int main(){
    driverparam b;
    b.paramOptions.defaultVal = 2;
    std::cout &lt;&lt; b.paramOptions.defaultVal &lt;&lt; endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1090574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090574</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:40:15 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:41:05 GMT]]></title><description><![CDATA[<p>Wenn ich es mit</p>
<pre><code>::std::string name;
</code></pre>
<p>probiere kommt ein Fehler</p>
<blockquote>
<p>parse error before `:'</p>
</blockquote>
<p>Probiere ich es mit</p>
<pre><code>std::string name;
</code></pre>
<p>kommt der Fehler</p>
<blockquote>
<p>parse error before `std'</p>
</blockquote>
<p>Gebe ich den Namen der Include-Datei nur mit &quot;&lt;string&gt;&quot; an, kommt der Fehler, dass die Datei nicht gefunden wurde.</p>
<p>Ich arbeite unter einem QNX 6.3. Der Compiler ist ein GCC. Ich glaube in der Version 2.95.3</p>
<p>mfg chuqa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090575</guid><dc:creator><![CDATA[Chuqa]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:41:05 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:50:05 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<blockquote>
<p>Also um jetzt mal alles richtige zusammenzusammeln und alles falsche zu kürzen, so muss es sein (Anmerkung: ohne using, mit std::, beides zusammen ist überflüssig und :: vor dem std erst recht )</p>
</blockquote>
<p>Da hast du Recht, aber &quot;meine Methode&quot; geht auch. <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="🙂"
    /></p>
<p>Ja, einmal reicht, war nur dazugefuscht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>MFG winexec*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090578</guid><dc:creator><![CDATA[winexec*]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:55:13 GMT]]></title><description><![CDATA[<blockquote>
<p>Gebe ich den Namen der Include-Datei nur mit &quot;&lt;string&gt;&quot; an, kommt der Fehler, dass die Datei nicht gefunden wurde.</p>
</blockquote>
<p>Wenn er &lt;string&gt; nicht findet, kann es sein, das er keine C++ Standard Bibliothek unterstützt. Evtl. mußt du diese zus. deinem Compilerkit hinzufügen, damit du eine ISO-konforme C++ Compilerumgebung hast.</p>
<p>Die Fehler davor sind eine Folge davon, das &lt;string&gt; nicht gefunden wurde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090581</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090581</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:55:13 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 09:54:13 GMT]]></title><description><![CDATA[<p>winexec* schrieb:</p>
<blockquote>
<p>Hallo,</p>
<blockquote>
<p>Also um jetzt mal alles richtige zusammenzusammeln und alles falsche zu kürzen, so muss es sein (Anmerkung: ohne using, mit std::, beides zusammen ist überflüssig und :: vor dem std erst recht )</p>
</blockquote>
<p>Da hast du Recht, aber &quot;meine Methode&quot; geht auch. <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="🙂"
    /></p>
</blockquote>
<p>Ja, aber zwei Tastenschläge zu viel und der Sourcecode wird durch zwei unnötige Doppelpunkte auch nicht besser lesbar. Klar, vieles geht, obs Sinn macht, ist eine andere Frage.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090583</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Mon, 03 Jul 2006 09:54:13 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 10:25:02 GMT]]></title><description><![CDATA[<p>Naja also die &lt;string.h&gt; findet er ja. Das Gleiche passiert mit anderen Include-Dateien auch, so z.B. mit &lt;stdio.h&gt;. Nichtsdestotrotz kann er mit dem Datentyp &quot;string&quot; nichts anfangen.</p>
<p>mfg chuqa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090600</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090600</guid><dc:creator><![CDATA[Chuqa]]></dc:creator><pubDate>Mon, 03 Jul 2006 10:25:02 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 10:46:47 GMT]]></title><description><![CDATA[<p>Du willst aber nicht die &lt;string.h&gt;, sondern die &lt;string&gt;.</p>
<p>Wie wäre es mal mit einem Compiler-Update? Wenn du einen Compiler benutzt, der fast ein Jahrzehnt alt ist, mußt du dich nicht wundern, wenn mit Code im aktuellen Standard-C++ was schief geht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090609</guid><dc:creator><![CDATA[Z2]]></dc:creator><pubDate>Mon, 03 Jul 2006 10:46:47 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 10:47:20 GMT]]></title><description><![CDATA[<p>Ist &lt;string.h&gt; und &lt;string&gt; das gleiche??? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> Nein! Hier interessiert es nicht ob er &lt;string.h&gt; findet, da es was anderes als &lt;string&gt; ist. Wir reden hier von Nullen und Einsen, und nicht von Gefühlen. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1090610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090610</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Mon, 03 Jul 2006 10:47:20 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturen und Strings on Mon, 03 Jul 2006 10:53:18 GMT]]></title><description><![CDATA[<p><em>g, okay, okay.<br />
Ihr habt ja recht. Der Compiler findet auch &lt;string&gt; man muss halt nur bei der Dateiendung des Files, welches kompiliert werden soll, ein c mehr ranhängen (</em>.cc anstatt *.c)*ditsch. Also ein richtig schöner dummer Fehler von mir.<br />
Ich danke euch, für eure Hilfe</p>
<p>mfg chuqa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1090613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1090613</guid><dc:creator><![CDATA[Chuqa]]></dc:creator><pubDate>Mon, 03 Jul 2006 10:53:18 GMT</pubDate></item></channel></rss>