<?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[Eine minimale Windows-Anwenung mit unerklährlichem Fehler ...]]></title><description><![CDATA[<p>Hallo Coder,<br />
habe da eine mir bislang unbekannten Fehler bei der Programmierung eines &quot;Fensters.&quot; Der Fehlerauswurf: &quot;undefined reference to 'TextOutA@20'<br />
Ist das ein Adressierungsfehler?</p>
<p>Meine derzeitige Arbeitskonfiguration:<br />
Codeblocks 13.12 und Mingw Compiler, Win7-Pro und das Buch &quot;C Lernen und prof anwenden. Beispiel aus Kapitel 21, S 400 bis 408. Leider habe ich von den Verfassern noch keine Antwort bekommen, was sehr bedauerlich ist. Schade Mitp Verlag!</p>
<p>Am Ende soll sich ein Programmfenster öffnen mit einem minimalen Text.</p>
<p>Der Code:<br />
////Basis.c --&gt; Eine minimale Windows-Anwendung in C<br />
#include &lt;windows.h&gt;</p>
<p>//Globale variablen<br />
HINSTANCE hInst = 0;<br />
char szAppName[] = &quot;Basis&quot;;<br />
char szTitle[100] = &quot;Hallo Windows&quot;;</p>
<p>//Prototypen eigener Funktionen<br />
BOOL InitApplikation();<br />
BOOL InitInstance(int);<br />
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );</p>
<p>//Der Programm Einstiegspunkt<br />
int WINAPI WinMain( HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int cCmdShow )<br />
{<br />
MSG msg;//Platz für eine neue Message<br />
hInst = hInstance;//handle an eine neue Instanz zuweisen</p>
<p>if(!InitApplication())<br />
return (FALSE);</p>
<p>if(!InitInstance(cCmdShow))<br />
return (FALSE);</p>
<p>while(GetMessage( &amp;msg, NULL, 0, 0 ) )<br />
{<br />
TranslateMessage( &amp;msg);<br />
DispatchMessage( &amp;msg);<br />
}<br />
return ( msg.wParam );<br />
}</p>
<p>BOOL InitApplication()////// jetzt die Fensterklasse registrieren<br />
{<br />
WNDCLASSEX wc; //Fensterklasse</p>
<p>//Anzahl der bytes dieser Struktur<br />
wc.cbSize = sizeof( WNDCLASSEX );<br />
wc.style = CS_HREDRAW | CS_VREDRAW;<br />
wc.lpfnWndProc = ( WNDPROC )WndProc;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
wc.hInstance = hInst;<br />
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );<br />
wc.hCursor = LoadCursor( NULL, IDC_ARROW );<br />
wc.hbrBackground = ( HBRUSH )GetStockObject( WHITE_BRUSH );<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = szAppName;<br />
wc.hIconSm = LoadIcon( NULL, IDI_APPLICATION );</p>
<p>return RegisterClassEx(&amp;wc);<br />
}<br />
//////////Hauptfenster erzeugen und anzeigen it InitInstance()<br />
BOOL InitInstance( int nCmdshow )<br />
{<br />
HWND hWnd;<br />
hWnd = CreateWindow( szAppName,<br />
szTitle,<br />
WS_OVERLAPPEDWINDOW,<br />
CW_USEDEFAULT,<br />
0,<br />
CW_USEDEFAULT,<br />
0,<br />
NULL,<br />
NULL,<br />
hInst,<br />
NULL );</p>
<p>if( !hWnd )<br />
return( FALSE );</p>
<p>ShowWindow( hWnd, nCmdshow );<br />
UpdateWindow( hWnd );</p>
<p>return( TRUE );<br />
}<br />
////Fenster Prozedur definieren. Die Funktion Wndproc()<br />
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )<br />
{<br />
PAINTSTRUCT ps;<br />
HDC hdc;<br />
char szText[] = &quot;Mein erstes handgestricktes Windows-Programm&quot;;</p>
<p>switch( message )</p>
<p>{<br />
case WM_PAINT:<br />
hdc = BeginPaint( hWnd, &amp;ps );</p>
<p>//Hier Ausgabe in der Client Area, zB. ein Text ...<br />
TextOut( hdc, 100,100, szText, strlen( szText ) );</p>
<p>EndPaint( hWnd, &amp;ps );<br />
break;</p>
<p>case WM_DESTROY:<br />
PostQuitMessage(0);<br />
break;</p>
<p>default:<br />
return DefWindowProc( hWnd, message, wParam, lParam );<br />
}<br />
return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/325538/eine-minimale-windows-anwenung-mit-unerklährlichem-fehler</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 08:19:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/325538.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 May 2014 09:24:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eine minimale Windows-Anwenung mit unerklährlichem Fehler ... on Wed, 07 May 2014 09:24:11 GMT]]></title><description><![CDATA[<p>Hallo Coder,<br />
habe da eine mir bislang unbekannten Fehler bei der Programmierung eines &quot;Fensters.&quot; Der Fehlerauswurf: &quot;undefined reference to 'TextOutA@20'<br />
Ist das ein Adressierungsfehler?</p>
<p>Meine derzeitige Arbeitskonfiguration:<br />
Codeblocks 13.12 und Mingw Compiler, Win7-Pro und das Buch &quot;C Lernen und prof anwenden. Beispiel aus Kapitel 21, S 400 bis 408. Leider habe ich von den Verfassern noch keine Antwort bekommen, was sehr bedauerlich ist. Schade Mitp Verlag!</p>
<p>Am Ende soll sich ein Programmfenster öffnen mit einem minimalen Text.</p>
<p>Der Code:<br />
////Basis.c --&gt; Eine minimale Windows-Anwendung in C<br />
#include &lt;windows.h&gt;</p>
<p>//Globale variablen<br />
HINSTANCE hInst = 0;<br />
char szAppName[] = &quot;Basis&quot;;<br />
char szTitle[100] = &quot;Hallo Windows&quot;;</p>
<p>//Prototypen eigener Funktionen<br />
BOOL InitApplikation();<br />
BOOL InitInstance(int);<br />
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );</p>
<p>//Der Programm Einstiegspunkt<br />
int WINAPI WinMain( HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int cCmdShow )<br />
{<br />
MSG msg;//Platz für eine neue Message<br />
hInst = hInstance;//handle an eine neue Instanz zuweisen</p>
<p>if(!InitApplication())<br />
return (FALSE);</p>
<p>if(!InitInstance(cCmdShow))<br />
return (FALSE);</p>
<p>while(GetMessage( &amp;msg, NULL, 0, 0 ) )<br />
{<br />
TranslateMessage( &amp;msg);<br />
DispatchMessage( &amp;msg);<br />
}<br />
return ( msg.wParam );<br />
}</p>
<p>BOOL InitApplication()////// jetzt die Fensterklasse registrieren<br />
{<br />
WNDCLASSEX wc; //Fensterklasse</p>
<p>//Anzahl der bytes dieser Struktur<br />
wc.cbSize = sizeof( WNDCLASSEX );<br />
wc.style = CS_HREDRAW | CS_VREDRAW;<br />
wc.lpfnWndProc = ( WNDPROC )WndProc;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
wc.hInstance = hInst;<br />
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );<br />
wc.hCursor = LoadCursor( NULL, IDC_ARROW );<br />
wc.hbrBackground = ( HBRUSH )GetStockObject( WHITE_BRUSH );<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = szAppName;<br />
wc.hIconSm = LoadIcon( NULL, IDI_APPLICATION );</p>
<p>return RegisterClassEx(&amp;wc);<br />
}<br />
//////////Hauptfenster erzeugen und anzeigen it InitInstance()<br />
BOOL InitInstance( int nCmdshow )<br />
{<br />
HWND hWnd;<br />
hWnd = CreateWindow( szAppName,<br />
szTitle,<br />
WS_OVERLAPPEDWINDOW,<br />
CW_USEDEFAULT,<br />
0,<br />
CW_USEDEFAULT,<br />
0,<br />
NULL,<br />
NULL,<br />
hInst,<br />
NULL );</p>
<p>if( !hWnd )<br />
return( FALSE );</p>
<p>ShowWindow( hWnd, nCmdshow );<br />
UpdateWindow( hWnd );</p>
<p>return( TRUE );<br />
}<br />
////Fenster Prozedur definieren. Die Funktion Wndproc()<br />
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )<br />
{<br />
PAINTSTRUCT ps;<br />
HDC hdc;<br />
char szText[] = &quot;Mein erstes handgestricktes Windows-Programm&quot;;</p>
<p>switch( message )</p>
<p>{<br />
case WM_PAINT:<br />
hdc = BeginPaint( hWnd, &amp;ps );</p>
<p>//Hier Ausgabe in der Client Area, zB. ein Text ...<br />
TextOut( hdc, 100,100, szText, strlen( szText ) );</p>
<p>EndPaint( hWnd, &amp;ps );<br />
break;</p>
<p>case WM_DESTROY:<br />
PostQuitMessage(0);<br />
break;</p>
<p>default:<br />
return DefWindowProc( hWnd, message, wParam, lParam );<br />
}<br />
return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2397825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2397825</guid><dc:creator><![CDATA[Duessel]]></dc:creator><pubDate>Wed, 07 May 2014 09:24:11 GMT</pubDate></item><item><title><![CDATA[Reply to Eine minimale Windows-Anwenung mit unerklährlichem Fehler ... on Wed, 07 May 2014 09:32:10 GMT]]></title><description><![CDATA[<p>Duessel schrieb:</p>
<blockquote>
<p>Der Fehlerauswurf: &quot;undefined reference to 'TextOutA@20'<br />
Ist das ein Adressierungsfehler?</p>
</blockquote>
<p>Nein, das bedeutet, dass du Gdi32.lib nicht gelinkt hast.</p>
<p>Duessel schrieb:</p>
<blockquote>
<p>Leider habe ich von den Verfassern noch keine Antwort bekommen, was sehr bedauerlich ist. Schade Mitp Verlag!</p>
</blockquote>
<p>Ja, das ist echt bitter. Schade, dass es kein weltweites Computernetzwerk gibt, das man nach der Fehlermeldung durchsuchen könnte. Aber selbst wenn: Du bist sicherlich der erste, der dieses Problem hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2397828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2397828</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 07 May 2014 09:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Eine minimale Windows-Anwenung mit unerklährlichem Fehler ... on Wed, 07 May 2014 10:25:31 GMT]]></title><description><![CDATA[<p>Wie kann ich das bewerkstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2397843</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2397843</guid><dc:creator><![CDATA[Duessel]]></dc:creator><pubDate>Wed, 07 May 2014 10:25:31 GMT</pubDate></item><item><title><![CDATA[Reply to Eine minimale Windows-Anwenung mit unerklährlichem Fehler ... on Wed, 07 May 2014 10:32:25 GMT]]></title><description><![CDATA[<p>Duessel schrieb:</p>
<blockquote>
<p>Wie kann ich das bewerkstellen?</p>
</blockquote>
<p>Was? Eine Suchmaschine bedienen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2397847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2397847</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 07 May 2014 10:32:25 GMT</pubDate></item><item><title><![CDATA[Reply to Eine minimale Windows-Anwenung mit unerklährlichem Fehler ... on Wed, 07 May 2014 11:09:29 GMT]]></title><description><![CDATA[<p>Duessel schrieb:</p>
<blockquote>
<p>Wie kann ich das bewerkstellen?</p>
</blockquote>
<p>OK. jetzt hab ich es. Super Tip mit der Verlinkung der Gdi32. DANKE!</p>
<p>Der Link hierzu:<br />
<a href="http://stackoverflow.com/questions/5862757/how-do-i-link-to-a-library-with-codeblocks" rel="nofollow">http://stackoverflow.com/questions/5862757/how-do-i-link-to-a-library-with-codeblocks</a></p>
<p>Zusätzlich muss man in &quot;Code::Blocks&quot; den Code aus der &quot;win32&quot; Projektdatei<br />
rauslöschen und den Code den ich programmiert hatte einfügen, um den Buch treu zu bleiben.</p>
<p>Dann bleibt noch zu klären ob sich lieber auf FLTK oder SmartWin oder GTK stürzen?<br />
Was wäre vor allem in der Hinsicht auf die Zukunft, besser? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2397864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2397864</guid><dc:creator><![CDATA[Duessel]]></dc:creator><pubDate>Wed, 07 May 2014 11:09:29 GMT</pubDate></item></channel></rss>