<?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[Multiple define von einer Funktion, hä ?]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>schreibe gerade so bisl an einem Programm aber bin auf ein Problem gestossen. Und zwar habe ich eine Datei namens &quot;GUIMaintainer.h&quot; und eine entsprechende .cpp. Die .h hat eigentlich include-guards oder wie man sie nennt und die .cpp included die .h datei entsprechend.<br />
Dann will ich in der main-datei die .cpp includen, bekomme aber die Fehlermeldung, dass &quot;GuiMaintainer::createLogion()&quot; mehrfach definiert wurde. Ist sie aber nicht ;O</p>
<p>Kurz die 2 Codes :</p>
<pre><code class="language-cpp">#ifndef _GUIMAINTAINER_H
#define _GUIMAINTAINER_H
#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;vector&gt;

class GuiMaintainer {
      private :
              struct chatwindow {
                     HANDLE mainWindow, input, output;
                     };      

              std::vector &lt; chatwindow &gt; ChatWindowHandles;
              HWND hLoginHandles[5], hclientList[5];
              HINSTANCE Inst;
              BOOL ChatActive;

      public :
              GuiMaintainer(HINSTANCE hInst) {
                     Inst = hInst;
                     ChatActive = FALSE;      
             }    

             BOOL createLogin();
             BOOL createClientList();
             BOOL createChatWindow();
             void UpdateWindowOutput( char* text , HANDLE windowHandle ); 

};
#endif
</code></pre>
<p>Und die .cpp</p>
<pre><code class="language-cpp">#include &quot;GUIMaintainer.h&quot;

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

BOOL GuiMaintainer::createLogin() {
      char szClassname[] = &quot;Login&quot;;
      WNDCLASSEX windowClass;
      windowClass.hInstance = Inst;
      windowClass.lpszClassName = szClassname;
      windowClass.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
      windowClass.style = CS_DBLCLKS;                 /* Catch double-clicks */
      windowClass.cbSize = sizeof (WNDCLASSEX);

      /* Use default icon and mouse-pointer */
      windowClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
      windowClass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
      windowClass.hCursor = LoadCursor (NULL, IDC_ARROW);
      windowClass.lpszMenuName = NULL;                 /* No menu */
      windowClass.cbClsExtra = 0;                      /* No extra bytes after the window class */
      windowClass.cbWndExtra = 0;                      /* structure or the window instance */
      /* Use Windows's default color as the background of the window */
      windowClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

     if (!RegisterClassEx (&amp;windowClass)) {
          MessageBox(NULL,&quot;ERROR&quot;,&quot;ERROR&quot;,MB_OK);
          exit(1);
         }
      hLoginHandles[0] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassname,         /* Classname */
           &quot;Happy Chatting&quot;,       /* Title Text */
           WS_OVERLAPPED | WS_SYSMENU | WS_VISIBLE  , /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           200,                 /* The programs width */
           400,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[1] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input name here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           30,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[2] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input Ip-Adress here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           60,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[3] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input Port here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           90,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

     hLoginHandles[4] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;button&quot;,         /* Classname */
           &quot;Connect&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           50,       /* Windows decides the position */
           150,       /* where the window ends up on the screen */
           100,                 /* The programs width */
           30,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );                    

}
</code></pre>
<p>Weiss echt nicht, was das Problem sein soll <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/287352/multiple-define-von-einer-funktion-hä</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 11:23:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/287352.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 May 2011 19:42:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Thu, 26 May 2011 19:42:41 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>schreibe gerade so bisl an einem Programm aber bin auf ein Problem gestossen. Und zwar habe ich eine Datei namens &quot;GUIMaintainer.h&quot; und eine entsprechende .cpp. Die .h hat eigentlich include-guards oder wie man sie nennt und die .cpp included die .h datei entsprechend.<br />
Dann will ich in der main-datei die .cpp includen, bekomme aber die Fehlermeldung, dass &quot;GuiMaintainer::createLogion()&quot; mehrfach definiert wurde. Ist sie aber nicht ;O</p>
<p>Kurz die 2 Codes :</p>
<pre><code class="language-cpp">#ifndef _GUIMAINTAINER_H
#define _GUIMAINTAINER_H
#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;vector&gt;

class GuiMaintainer {
      private :
              struct chatwindow {
                     HANDLE mainWindow, input, output;
                     };      

              std::vector &lt; chatwindow &gt; ChatWindowHandles;
              HWND hLoginHandles[5], hclientList[5];
              HINSTANCE Inst;
              BOOL ChatActive;

      public :
              GuiMaintainer(HINSTANCE hInst) {
                     Inst = hInst;
                     ChatActive = FALSE;      
             }    

             BOOL createLogin();
             BOOL createClientList();
             BOOL createChatWindow();
             void UpdateWindowOutput( char* text , HANDLE windowHandle ); 

};
#endif
</code></pre>
<p>Und die .cpp</p>
<pre><code class="language-cpp">#include &quot;GUIMaintainer.h&quot;

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

BOOL GuiMaintainer::createLogin() {
      char szClassname[] = &quot;Login&quot;;
      WNDCLASSEX windowClass;
      windowClass.hInstance = Inst;
      windowClass.lpszClassName = szClassname;
      windowClass.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
      windowClass.style = CS_DBLCLKS;                 /* Catch double-clicks */
      windowClass.cbSize = sizeof (WNDCLASSEX);

      /* Use default icon and mouse-pointer */
      windowClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
      windowClass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
      windowClass.hCursor = LoadCursor (NULL, IDC_ARROW);
      windowClass.lpszMenuName = NULL;                 /* No menu */
      windowClass.cbClsExtra = 0;                      /* No extra bytes after the window class */
      windowClass.cbWndExtra = 0;                      /* structure or the window instance */
      /* Use Windows's default color as the background of the window */
      windowClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

     if (!RegisterClassEx (&amp;windowClass)) {
          MessageBox(NULL,&quot;ERROR&quot;,&quot;ERROR&quot;,MB_OK);
          exit(1);
         }
      hLoginHandles[0] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassname,         /* Classname */
           &quot;Happy Chatting&quot;,       /* Title Text */
           WS_OVERLAPPED | WS_SYSMENU | WS_VISIBLE  , /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           200,                 /* The programs width */
           400,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[1] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input name here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           30,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[2] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input Ip-Adress here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           60,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

      hLoginHandles[3] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;edit&quot;,         /* Classname */
           &quot;Input Port here !&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           30,       /* Windows decides the position */
           90,       /* where the window ends up on the screen */
           140,                 /* The programs width */
           20,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

     hLoginHandles[4] = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           &quot;button&quot;,         /* Classname */
           &quot;Connect&quot;,       /* Title Text */
           WS_VISIBLE | WS_CHILD  , /* default window */
           50,       /* Windows decides the position */
           150,       /* where the window ends up on the screen */
           100,                 /* The programs width */
           30,                 /* and height in pixels */
           hLoginHandles[0],        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           Inst,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );                    

}
</code></pre>
<p>Weiss echt nicht, was das Problem sein soll <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2069376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069376</guid><dc:creator><![CDATA[Komisch]]></dc:creator><pubDate>Thu, 26 May 2011 19:42:41 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Thu, 26 May 2011 19:48:42 GMT]]></title><description><![CDATA[<p>Komisch schrieb:</p>
<blockquote>
<p>Dann will ich in der main-datei die .cpp includen, bekomme aber die Fehlermeldung, dass &quot;GuiMaintainer::createLogion()&quot; mehrfach definiert wurde. Ist sie aber nicht ;O</p>
</blockquote>
<p>Man includet ja auch keine .cpp Dateien, sondern nur die Header. Die .cpp wird für sich alleine compiliert und mit der main zusammengelinkt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2069382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069382</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 26 May 2011 19:48:42 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Thu, 26 May 2011 19:48:45 GMT]]></title><description><![CDATA[<blockquote>
<p>Dann will ich in der main-datei die .cpp includen</p>
</blockquote>
<p>Man included keine .cpp's. Man included .h's! Der Rest ist Aufgabe des Linkers.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2069383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069383</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Thu, 26 May 2011 19:48:45 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Thu, 26 May 2011 19:55:49 GMT]]></title><description><![CDATA[<p>;O Tatsächlich ;P Vielen dank euch beiden ! Ich hab das einfach nur der Logik halber so gemacht ;P .cpp included .h und main dann die .cpp, die ja die entsprechende Definitionen ergo auch funktionierenden code bereitstellt. Wusste aber ehrlich nicht, wie der Compiler was linkt ;P Kommt davon, dass ich so solten mit verschiedenen Datein ( nennt sich Module ? ) arbeite <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>
<p>Nochmal danke und schönen Abend !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2069391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069391</guid><dc:creator><![CDATA[Komisch]]></dc:creator><pubDate>Thu, 26 May 2011 19:55:49 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Fri, 27 May 2011 06:09:18 GMT]]></title><description><![CDATA[<blockquote>
<p>wie der Compiler was linkt</p>
</blockquote>
<p>Gar nicht. Der Linker linkt - der Compiler kompiliert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2069508</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069508</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 27 May 2011 06:09:18 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple define von einer Funktion, hä ? on Fri, 27 May 2011 08:22:35 GMT]]></title><description><![CDATA[<p>Komisch schrieb:</p>
<blockquote>
<p>Kommt davon, dass ich so solten mit verschiedenen Datein ( nennt sich Module ? ) arbeite <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>
</blockquote>
<p>Dann solltest du dich in die Thematik einlesen und sicher sein, wie man das macht. Wenn du es nicht genau weißt und einfach rumprobierst solltest du dich auch nicht über Fehler wundern <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/2069559</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2069559</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Fri, 27 May 2011 08:22:35 GMT</pubDate></item></channel></rss>