<?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[Problem mit vordefinierten Parametern&#x2F;Attributen]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin Informatik-Student und hab bisher mehr Erfahrung in Java.<br />
Jetzt belege ich aber gerade das Wahlpflichtfach &quot;C++&quot; und hab ein kleineres(?) Problem.</p>
<p>Als Übung sollen wir eine doppelt-verkettete Liste schreiben.<br />
Das funktioniert auch schon soweit, nur mit den vorbesetzten Parametern motzt mein Compiler...</p>
<p>Hier mal ein paar Code-Auszüge:</p>
<p>DoubleLinkedList.h:</p>
<pre><code class="language-csharp">#ifndef DOUBLELINKEDLIST_H_
#define DOUBLELINKEDLIST_H_

#include &quot;DoubleLinkedListElement.h&quot;
#include &lt;iostream&gt;

using namespace std;

class DoubleLinkedList
{	
	friend class DoubleLinkedListElement;
	friend DoubleLinkedList operator+(const DoubleLinkedList&amp;, const DoubleLinkedList&amp;);

	private:
		unsigned int length;
		DoubleLinkedListElement* head;
		void init();
	public:	
		DoubleLinkedList();
		DoubleLinkedList(const char** , unsigned int );
		.
		.
		.
}
</code></pre>
<p>DoubleLinkedList.cpp:</p>
<pre><code class="language-csharp">#include &quot;DoubleLinkedList.h&quot;
#include &lt;cstring&gt;

DoubleLinkedList::DoubleLinkedList()
{
	init();
}	

DoubleLinkedList::DoubleLinkedList(const char* elements[], unsigned int count, unsigned int offset=10)
{
	init();
	addArray(elements,count,offset);
}

.
.
.
</code></pre>
<p>Makefile:</p>
<pre><code>DEP     = Test.cpp DoubleLinkedList.cpp DoubleLinkedListElement.cpp DoubleLinkedList.h DoubleLinkedListElement.h
CC      = /usr/bin/g++
CFLAGS  = -Wall
BIN     = DoubleLinkedList
OBJ		= Test.o DoubleLinkedList.o DoubleLinkedListElement.o

all: $(OBJ)
	$(CC) $(CFLAGS) -o $(BIN) $(OBJ)

$(BIN): $(DEP)
	$(CC) $(CFLAGS) -o $(BIN) $(OBJ)

%.o: %.cpp
	$(CC) $(CFLAGS) -c $&lt;

clean:
	rm -rf $(BIN) $(OBJ)
</code></pre>
<p>Test.cpp:</p>
<pre><code class="language-csharp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
using namespace std;
#include &quot;DoubleLinkedList.h&quot;

/**
 * Startfunktion des Programms
 */
int main(int argc, char **argv) {

	const char* a[] = {&quot;AAA&quot;,&quot;BBB&quot;,&quot;CCC&quot;,&quot;DDD&quot;,&quot;EEE&quot;,&quot;FFF&quot;,&quot;GGG&quot;,&quot;HHH&quot;,&quot;III&quot;,&quot;JJJ&quot;};
	DoubleLinkedList dll(a,10);
	dll.print();

}
</code></pre>
<p>Ausgabe beim Kompilieren:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -c Test.cpp
/usr/bin/g++ -Wall -c DoubleLinkedList.cpp
DoubleLinkedList.cpp:15: Fehler: Prototyp für »DoubleLinkedList::DoubleLinkedList(const char**, unsigned int, unsigned int)« passt zu nichts in Klasse »DoubleLinkedList«
DoubleLinkedList.h:10: Fehler: Kandidaten sind: DoubleLinkedList::DoubleLinkedList(const DoubleLinkedList&amp;)
DoubleLinkedList.h:20: Fehler:                 DoubleLinkedList::DoubleLinkedList(const char**, unsigned int)
DoubleLinkedList.cpp:4: Fehler:                 DoubleLinkedList::DoubleLinkedList()
/usr/bin/g++ -Wall -c DoubleLinkedListElement.cpp
make: *** [DoubleLinkedList.o] Fehler 1
make: Das Target »all« wurde wegen Fehlern nicht aktualisiert.
</code></pre>
<p>Der Fehler tritt auch noch bei einer weiteren Funktion auf, aber ich geh mal davon aus, dass das die selbe Ursache hat.</p>
<p>Zum Programmieren benutze ich Eclipse mit CDT.<br />
Mein OS ist Ubuntu 8.10 und mein Compiler g++ 4.3.2</p>
<p>Falls mir jemand bei meinem Denkfehler helfen kann wär das echt klasse.</p>
<p>Danke schon mal im voraus <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>P.S.: Die Programmiersprache ist C++, die C#-Tags sind nur zur Übersichtlichkeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/229371/problem-mit-vordefinierten-parametern-attributen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 28 Sep 2026 00:45:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/229371.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Dec 2008 20:28:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 20:28:37 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin Informatik-Student und hab bisher mehr Erfahrung in Java.<br />
Jetzt belege ich aber gerade das Wahlpflichtfach &quot;C++&quot; und hab ein kleineres(?) Problem.</p>
<p>Als Übung sollen wir eine doppelt-verkettete Liste schreiben.<br />
Das funktioniert auch schon soweit, nur mit den vorbesetzten Parametern motzt mein Compiler...</p>
<p>Hier mal ein paar Code-Auszüge:</p>
<p>DoubleLinkedList.h:</p>
<pre><code class="language-csharp">#ifndef DOUBLELINKEDLIST_H_
#define DOUBLELINKEDLIST_H_

#include &quot;DoubleLinkedListElement.h&quot;
#include &lt;iostream&gt;

using namespace std;

class DoubleLinkedList
{	
	friend class DoubleLinkedListElement;
	friend DoubleLinkedList operator+(const DoubleLinkedList&amp;, const DoubleLinkedList&amp;);

	private:
		unsigned int length;
		DoubleLinkedListElement* head;
		void init();
	public:	
		DoubleLinkedList();
		DoubleLinkedList(const char** , unsigned int );
		.
		.
		.
}
</code></pre>
<p>DoubleLinkedList.cpp:</p>
<pre><code class="language-csharp">#include &quot;DoubleLinkedList.h&quot;
#include &lt;cstring&gt;

DoubleLinkedList::DoubleLinkedList()
{
	init();
}	

DoubleLinkedList::DoubleLinkedList(const char* elements[], unsigned int count, unsigned int offset=10)
{
	init();
	addArray(elements,count,offset);
}

.
.
.
</code></pre>
<p>Makefile:</p>
<pre><code>DEP     = Test.cpp DoubleLinkedList.cpp DoubleLinkedListElement.cpp DoubleLinkedList.h DoubleLinkedListElement.h
CC      = /usr/bin/g++
CFLAGS  = -Wall
BIN     = DoubleLinkedList
OBJ		= Test.o DoubleLinkedList.o DoubleLinkedListElement.o

all: $(OBJ)
	$(CC) $(CFLAGS) -o $(BIN) $(OBJ)

$(BIN): $(DEP)
	$(CC) $(CFLAGS) -o $(BIN) $(OBJ)

%.o: %.cpp
	$(CC) $(CFLAGS) -c $&lt;

clean:
	rm -rf $(BIN) $(OBJ)
</code></pre>
<p>Test.cpp:</p>
<pre><code class="language-csharp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
using namespace std;
#include &quot;DoubleLinkedList.h&quot;

/**
 * Startfunktion des Programms
 */
int main(int argc, char **argv) {

	const char* a[] = {&quot;AAA&quot;,&quot;BBB&quot;,&quot;CCC&quot;,&quot;DDD&quot;,&quot;EEE&quot;,&quot;FFF&quot;,&quot;GGG&quot;,&quot;HHH&quot;,&quot;III&quot;,&quot;JJJ&quot;};
	DoubleLinkedList dll(a,10);
	dll.print();

}
</code></pre>
<p>Ausgabe beim Kompilieren:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -c Test.cpp
/usr/bin/g++ -Wall -c DoubleLinkedList.cpp
DoubleLinkedList.cpp:15: Fehler: Prototyp für »DoubleLinkedList::DoubleLinkedList(const char**, unsigned int, unsigned int)« passt zu nichts in Klasse »DoubleLinkedList«
DoubleLinkedList.h:10: Fehler: Kandidaten sind: DoubleLinkedList::DoubleLinkedList(const DoubleLinkedList&amp;)
DoubleLinkedList.h:20: Fehler:                 DoubleLinkedList::DoubleLinkedList(const char**, unsigned int)
DoubleLinkedList.cpp:4: Fehler:                 DoubleLinkedList::DoubleLinkedList()
/usr/bin/g++ -Wall -c DoubleLinkedListElement.cpp
make: *** [DoubleLinkedList.o] Fehler 1
make: Das Target »all« wurde wegen Fehlern nicht aktualisiert.
</code></pre>
<p>Der Fehler tritt auch noch bei einer weiteren Funktion auf, aber ich geh mal davon aus, dass das die selbe Ursache hat.</p>
<p>Zum Programmieren benutze ich Eclipse mit CDT.<br />
Mein OS ist Ubuntu 8.10 und mein Compiler g++ 4.3.2</p>
<p>Falls mir jemand bei meinem Denkfehler helfen kann wär das echt klasse.</p>
<p>Danke schon mal im voraus <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>P.S.: Die Programmiersprache ist C++, die C#-Tags sind nur zur Übersichtlichkeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628460</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628460</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 20:28:37 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:03:16 GMT]]></title><description><![CDATA[<p>du hast in dem einen konstruktor in der header datei 2 parameter angegeben aber im cpp file dann 3...</p>
<p>das ist der einzige fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628472</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:03:16 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:09:12 GMT]]></title><description><![CDATA[<p>Naja, es ist genau das aufgetreten, was die Fehlermeldung auch beschreibt. Du hast in der .cpp-Datei eine Memberfunktion definiert, deren Signatur + Name so nicht in der Deklaration (im Header) auftritt.</p>
<p>MfG,<br />
Michael</p>
<p>PS: Ich schwöre, die Antwort war da vorher noch nicht! Das ist Voodoo!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628475</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:09:12 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:09:28 GMT]]></title><description><![CDATA[<p>Ups,</p>
<p>ich hatte zwischenzeitlich ne Lösung mit 2 Parametern eingebaut und jetzt wieder falsch rausgenommen.</p>
<p>Also richtig soll es so sein:</p>
<p>DoubleLinkedList.h:</p>
<pre><code class="language-csharp">.
.
.
DoubleLinkedList(const char** , unsigned int ,unsigned int );
.
.
.
</code></pre>
<p>und jetzt die Ausgabe vom Compiler:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -c DoubleLinkedList.cpp
/usr/bin/g++ -Wall -o DoubleLinkedList Test.o DoubleLinkedList.o DoubleLinkedListElement.o
Test.o: In function `main':
Test.cpp:(.text+0xc9): undefined reference to `DoubleLinkedList::DoubleLinkedList(char const**, unsigned int)'
collect2: ld gab 1 als Ende-Status zurück
make: *** [all] Fehler 1
</code></pre>
<p>Nur, warum klappt das nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628476</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628476</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:09:28 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:10:08 GMT]]></title><description><![CDATA[<p>Ariol schrieb:</p>
<blockquote>
<p>P.S.: Die Programmiersprache ist C++, die C#-Tags sind nur zur Übersichtlichkeit.</p>
</blockquote>
<p>Es gibt auch C++-Tags (erste Schaltfläche). <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/1628479</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628479</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:10:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:16:44 GMT]]></title><description><![CDATA[<p>Das ist sozusagen das Gegenproblem zu dem letzten. Jetzt fehlt die Implementierung einer Funktion, die im Header aber deklariert wurde. (Und für einen Aufruf in deiner main.cpp den besten &quot;Match&quot; für den Überladenen Konstruktor liefern würde)</p>
<p>PS: Ich sehe, du kommst wahrscheinlich mit default-parametern noch nicht so zurecht. Wenn du eine Memberfunktion definierst, dann bedeutet dort die Angabe eines Standardparameters nicht, dass die Funktion für den Compiler dann diejenige in der Deklaration ist, die halt diesen Parameter nicht bietet. Diese Defaultwerte sind nur dazu da, dass ein Aufrufer bei oft auftretenden Fällen nicht immer dieselben Parameter angeben muss (Darum müssen die auch eher im Header definiert sein...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628480</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:13:23 GMT]]></title><description><![CDATA[<p>Wurde sie ja eben nicht.</p>
<p>Hier mal alles:</p>
<p>DoubleLinkedList.h</p>
<pre><code class="language-cpp">#ifndef DOUBLELINKEDLIST_H_
#define DOUBLELINKEDLIST_H_

#include &quot;DoubleLinkedListElement.h&quot;
#include &lt;iostream&gt;

using namespace std;

class DoubleLinkedList
{	
	friend class DoubleLinkedListElement;
	friend DoubleLinkedList operator+(const DoubleLinkedList&amp;, const DoubleLinkedList&amp;);

	private:
		unsigned int length;
		DoubleLinkedListElement* head;
		void init();
	public:	
		DoubleLinkedList();
		DoubleLinkedList(const char** , unsigned int ,unsigned int );
		//DoubleLinkedList(const char**, unsigned int);
		void push_back(const char*);
		void push_front(const char*);
		const char* pop_back();
		const char* pop_front();
		void insert(unsigned int,const char*);
		void addArray(const char*[] ,unsigned int ,unsigned int);
		void remove(unsigned int);
		unsigned int getLength() const;
		bool operator==(const DoubleLinkedList&amp;) const;
		bool operator!=(const DoubleLinkedList&amp;) const;
		DoubleLinkedList operator+=(const DoubleLinkedList&amp;);
		const char* operator[](unsigned int) const;
		void print();
};

//#include &quot;DoubleLinkedList.cpp&quot;

#endif /*DOUBLELINKEDLIST_H_*/
</code></pre>
<p>DoubleLinkedList.cpp</p>
<pre><code class="language-cpp">#include &quot;DoubleLinkedList.h&quot;
#include &lt;cstring&gt;

DoubleLinkedList::DoubleLinkedList()
{
	init();
}	
/*
DoubleLinkedList::DoubleLinkedList(const char* elements[] , unsigned int count)
{
	init();
	addArray(elements,count,0);	
}*/

DoubleLinkedList::DoubleLinkedList(const char* elements[], unsigned int count, unsigned int offset=10)
{
	init();
	addArray(elements,count,offset);
}

void DoubleLinkedList::init()
{
	//Liste auf Ursprung setzen
	head = NULL; 
	length = 0;
}

void DoubleLinkedList::push_back(const char* element)
{
	//Wenn Liste leer...
	if(!head)
	{
		//...Element als head einfügen
		head = new DoubleLinkedListElement(element,NULL,NULL);
		head-&gt;prev = head;
		head-&gt;next = head;
	}
	//Ansonsten...
	else
	{
		//...ans Ende anhängen (vor dem head einfügen) 
		DoubleLinkedListElement* dlle = new DoubleLinkedListElement(element,head-&gt;prev,head);
		dlle-&gt;prev-&gt;next = dlle;
		dlle-&gt;next-&gt;prev = dlle;	
	}
	//Zähler erhöhen
	length++;
}

void DoubleLinkedList::push_front(const char* element)
{
	//Element am Ende anhängen (vor dem head)
	this-&gt;push_back(element);
	//head auf das bisher letzte Element der Liste setzen
	head = head-&gt;prev;
}

const char* DoubleLinkedList::pop_back()
{
	//Liste ist leer
	if(!head) return NULL;

	//Zeiger auf das letzte Element der Liste
	DoubleLinkedListElement* dlle = head-&gt;prev;

	//Das einzige Element soll entfernt werden
	if(dlle == head &amp;&amp; dlle-&gt;next == head) head = NULL;

	//Wert auslesen
	const char* value = dlle-&gt;value;

	//Zeiger der umgebenden Elemente ändern
	dlle-&gt;prev-&gt;next = dlle-&gt;next;
	dlle-&gt;next-&gt;prev = dlle-&gt;prev;

	//Element löschen	 
	delete dlle;
	//Zähler dekrementieren
	length--;
	//Wert zurückgeben
	return value;
}

const char* DoubleLinkedList::pop_front()
{
	if(!head) return NULL;

	//head auf das 2. Element der Liste setzen
	head = head-&gt;next;

	//Letztes Element der Liste entfernen (vorheriger Head) und Wert zurückgeben
	return pop_back();
}

void DoubleLinkedList::addArray(const char* elements[], unsigned int count, unsigned int offset=0)
{	
	//Elemente einfügen
	for(unsigned int i = offset; i &lt; count+offset; i++)
	{
		push_back(elements[i]);
	}
}

void DoubleLinkedList::insert(unsigned int position,const char* element)
{
	//Wenn Liste leer oder Position zu groß...
	if(!head || position &gt; length)
	{
		//...am Ende anhängen
		push_back(element);
	}
	//Ansonsten...
	else
	{
		//...An entsprechender Position einsetzen
		DoubleLinkedListElement* posElement = head;
		for(unsigned int i = 0; i &lt; position; i++) posElement = posElement-&gt;next;
		DoubleLinkedListElement* dlle = new DoubleLinkedListElement(element,posElement-&gt;prev,posElement);
		dlle-&gt;prev-&gt;next = dlle;
		dlle-&gt;next-&gt;prev = dlle;
		length++;
	}
}

void DoubleLinkedList::remove(unsigned int position)
{
	//Liste ist leer, also nix tun
	if(!head)return;
	//Position == 0
	else if(position == 0)
	{
		//...erstes Element wird entfernt
		pop_front();
	}
	//Position ist zu groß...
	else if(position &gt; length-1)
	{
		//...letztes Element wird entfernt
		pop_back();
	}	
	//Ansonsten
	else
	{
		//...Position ermitteln
		DoubleLinkedListElement* dlle = head;
		for(unsigned int i = 0; i &lt; position; i++)dlle=dlle-&gt;next;

		//...Zeiger der Nachbarelemente tauschen
		dlle-&gt;prev-&gt;next = dlle-&gt;next;
		dlle-&gt;next-&gt;prev = dlle-&gt;prev;			
		//Element löschen 
		delete dlle;
		//Zeiger dekrementieren
		length--;
	} 	
}

unsigned int DoubleLinkedList::getLength() const
{
	//Länge der Liste zurückgeben
	return length;
}

bool DoubleLinkedList::operator==(const DoubleLinkedList&amp; list) const
{	
	DoubleLinkedList self(*this);
	unsigned int llength = list.getLength();

	//Wenn die Länge ungleich ist, sind die Listen nicht gleich
	if(length != llength) return false;

	//Elementweises vergleichen
	for(unsigned int i = 0; i &lt; length; i++) 
	{
		//Wenn die Elemente nicht gleich sind, sind die Listen nicht gleich
		if(strcmp(self[i],list[i]))return false; 
	}

	//Listen sind gleich
	return true;
}

bool DoubleLinkedList::operator!=(const DoubleLinkedList&amp; list) const
{
	return !operator ==(list);
}

DoubleLinkedList operator+(const DoubleLinkedList&amp; list1 ,const DoubleLinkedList&amp; list2)
{
	DoubleLinkedList tmp;	

	//1. Liste zur tmp-liste hinzufügen
	tmp+=list1;
	//2. Liste zur tmp-liste hinzufügen
	tmp+=list2;
	//tmp-liste zurückgeben
	return tmp;
}

DoubleLinkedList DoubleLinkedList::operator+=(const DoubleLinkedList&amp; list)
{
	//Elementweises anhängen der Elemente
	for(unsigned int i = 0; i &lt; list.getLength(); i++)
	{
		this-&gt;push_back(list[i]);
	}
	//Gibt sich selbst zurück
	return *this;
}

const char* DoubleLinkedList::operator[](unsigned int position) const
{
	//Liste leer oder Position zu groß
	if(!head || position &gt;= length)return NULL;

	//Element an der gewünschten Position suchen
	DoubleLinkedListElement* dlle = head;
	for(unsigned int i = 0; i &lt; position; i++) dlle=dlle-&gt;next;

	//Wert des Elements zurückgeben
	return dlle-&gt;value;
}

void DoubleLinkedList::print()
{
	//Alle elemente ausgeben 
	DoubleLinkedList self = DoubleLinkedList(*this);
	cout &lt;&lt; &quot;-----------------------\n&quot;
		 &lt;&lt; &quot;length: &quot; &lt;&lt; length &lt;&lt; &quot;\n&quot;
		 &lt;&lt; &quot;-----------------------&quot; &lt;&lt; endl;
	for(unsigned int i = 0; i &lt; length; i++)
	{
		cout &lt;&lt; i &lt;&lt; &quot;: &quot; &lt;&lt; self[i] &lt;&lt; endl;
	}
	cout &lt;&lt; &quot;-----------------------&quot; &lt;&lt; endl;
}
</code></pre>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12954">@Nexus</a>: War wohl blind...Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628482</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:13:23 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:20:13 GMT]]></title><description><![CDATA[<p>Du musst den Standardparameter im Header angeben. Wenn der Compiler die Test.cpp kompiliert, weiß er ja nicht, dass du in einer gänzlich anderen .cpp einen Standardwert für den letzten Parameter angegeben hast. Er sieht ja nur den Header, in dem 3 Parameter verlangt werden und es keinen Standardwert gibt, so dass man mit 2 Parametern aufrufen könnte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628489</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:20:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:23:06 GMT]]></title><description><![CDATA[<p>Habs jetzt mal so geändert:</p>
<pre><code class="language-cpp">#ifndef DOUBLELINKEDLIST_H_
#define DOUBLELINKEDLIST_H_

#include &quot;DoubleLinkedListElement.h&quot;
#include &lt;iostream&gt;

using namespace std;

class DoubleLinkedList
{	
	friend class DoubleLinkedListElement;
	friend DoubleLinkedList operator+(const DoubleLinkedList&amp;, const DoubleLinkedList&amp;);

	private:
		unsigned int length;
		DoubleLinkedListElement* head;
		void init();
	public:	
		DoubleLinkedList();
		DoubleLinkedList(const char**, unsigned int ,unsigned int );
		DoubleLinkedList(const char**, unsigned int);
		void push_back(const char*);
		void push_front(const char*);
		const char* pop_back();
		const char* pop_front();
		void insert(unsigned int,const char*);
		void addArray(const char*[] ,unsigned int ,unsigned int);
		void remove(unsigned int);
		unsigned int getLength() const;
		bool operator==(const DoubleLinkedList&amp;) const;
		bool operator!=(const DoubleLinkedList&amp;) const;
		DoubleLinkedList operator+=(const DoubleLinkedList&amp;);
		const char* operator[](unsigned int) const;
		void print();
};

//#include &quot;DoubleLinkedList.cpp&quot;

#endif /*DOUBLELINKEDLIST_H_*/
</code></pre>
<p>aber trotzdem:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -o DoubleLinkedList Test.o DoubleLinkedList.o DoubleLinkedListElement.o
Test.o: In function `main':
Test.cpp:(.text+0xc9): undefined reference to `DoubleLinkedList::DoubleLinkedList(char const**, unsigned int)'
collect2: ld gab 1 als Ende-Status zurück
make: *** [all] Fehler 1
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1628491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628491</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:23:06 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:28:50 GMT]]></title><description><![CDATA[<p>Ja, jetzt hast du DoubleLinkedList::DoubleLinkedList(char const**, unsigned int) hinzugefügt, also hat der Compiler nix zu meckern wenn er test.cpp kompiliert, aber wo hast du denn DoubleLinkedList::DoubleLinkedList(char const**, unsigned int) implementiert? Daran knabbert der Linker jetzt.</p>
<p>Das einzige was ich die ganze Zeit doch sagen möchte ist, du hättest im HEADER stehen haben müssen:</p>
<p>DoubleLinkedList(const char**, unsigned int ,unsigned int someval = 5 );</p>
<p>Dann hättest du auch keine zusätzliche Funktion deklarieren müssen, weil der Compiler dann, während er test.cpp kompiliert, weiß, dass der letzte Parameter einen default-Wert besitzt und man die Funktion somit auch mit 2 Parametern aufrufen kann.</p>
<p>Und überhaupt, im Header solltest du allen Parametern einen Namen geben, das macht es demjenigen einfacher, die Bibliothek zu benutzen, wenn er sich nur den Header (= Die Schnittstelle zu den Objekten) anschaut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628493</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628493</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:27:58 GMT]]></title><description><![CDATA[<p>Dann kann ich das also nicht weglassen?</p>
<p>Ich dachte, dass das der Sinn der vordefinierten Parameter ist.</p>
<p>Muss ich also den Konstruktor komplett anlegen, oder kann ich den Aufruf umleiten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628494</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:27:58 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:29:41 GMT]]></title><description><![CDATA[<p>Siehe oben, hab das nachträglich nochmal etwas verdeutlicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628496</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:29:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:34:15 GMT]]></title><description><![CDATA[<p>Also was es mitzunehmen gilt: Der Compiler sieht immer nur eine einzige .cpp datei und alles was diese datei #include'd hat. Der hat keine Ahnung davon, dass eine andere .cpp datei irgendwelche Standardparameter definiert. Der Linker ist dann dafür zuständig die ganzen Symbole zwischen mehreren &quot;Units&quot; (=.o-Dateien) aufzulösen und den Implementierungen (= Dem Maschinencode) zuzuordnen. Mal etwas vereinfacht ausgedrückt. Und da Standardparameter etwas sind, das auf Compilerebene wirkt, ergibt sich dein beobachtetes Problem.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628498</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628498</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:34:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:38:30 GMT]]></title><description><![CDATA[<p>OK:<br />
1. Hab ich jetzt alle Parameter mit Namen angegeben.<br />
2. Der Konstruktor lautet jetzt so:</p>
<pre><code class="language-cpp">DoubleLinkedList(const char* elements[], unsigned int count,unsigned int offest = 0);
</code></pre>
<p>Das hatte ich auch schonmal, aber es klappt nicht:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -c DoubleLinkedList.cpp
DoubleLinkedList.cpp:15: Fehler: Standardargument für Parameter 3 von »DoubleLinkedList::DoubleLinkedList(const char**, unsigned int, unsigned int)« angegeben
DoubleLinkedList.h:20: Fehler: nach vorheriger Spezifikation in »DoubleLinkedList::DoubleLinkedList(const char**, unsigned int, unsigned int)«
make: *** [DoubleLinkedList.o] Fehler 1
make: Das Target »all« wurde wegen Fehlern nicht aktualisiert
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1628499</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628499</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:38:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:41:08 GMT]]></title><description><![CDATA[<p>Naja, jetzt kannst du ja (rein logisch gesehen) und musst (dem C++-Standard nach) die Spezifikation eines Standardwertes für den 3. Parameter in der Implementierung weglassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628502</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628502</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 21:41:17 GMT]]></title><description><![CDATA[<p>Ariol schrieb:</p>
<blockquote>
<pre><code>make -k all 
...
DoubleLinkedList.cpp:15: Fehler: Standardargument für Parameter 3 von »DoubleLinkedList::DoubleLinkedList(const char**, unsigned int, unsigned int)« angegeben
...
</code></pre>
</blockquote>
<p>Lies mal bitte alle Postings nochmal durch.</p>
<p>Standardparameter müssen ausschließlich in der Deklaration angegeben werden. Der Compiler sagt aber das du in der &quot;DoubleLinkedList.cpp&quot; (und ich wette dort in der Definition) einen Standardwert angegeben hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628503</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Wed, 10 Dec 2008 21:41:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit vordefinierten Parametern&#x2F;Attributen on Wed, 10 Dec 2008 23:03:13 GMT]]></title><description><![CDATA[<p>Sorry, falsche Ausgabe gepostet:<br />
hier die richtige:</p>
<pre><code>make -k all 
/usr/bin/g++ -Wall -o DoubleLinkedList Test.o DoubleLinkedList.o DoubleLinkedListElement.o
Test.o: In function `main':
Test.cpp:(.text+0xc9): undefined reference to `DoubleLinkedList::DoubleLinkedList(char const**, unsigned int)'
collect2: ld gab 1 als Ende-Status zurück
make: *** [all] Fehler 1
</code></pre>
<p>.............</p>
<p>Ok, der Fehler war ein fehlendes &quot;make clean&quot;.</p>
<p>Mann, das hätte ich schon vorgestern haben können.</p>
<p>Vielen Dank für eure Hilfe. <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="😉"
    /> Jetzt klappt alles <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1628510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1628510</guid><dc:creator><![CDATA[Ariol]]></dc:creator><pubDate>Wed, 10 Dec 2008 23:03:13 GMT</pubDate></item></channel></rss>