<?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[Linker error (_main)]]></title><description><![CDATA[<p>Hallo,<br />
hoffe ich bin mit meiner Frage hier an der richtigen Stelle. Ich bin gerade dabei mir C++ beizubringen indem ich alte Programme von Delphi versuche nach C++ (VC++ Autorenversion) zu portieren, leider stehe ich erst ganz am Anfang. Hier nun der Code + Linker-meldung:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

 	{
			hdc = BeginPaint(hwnd,&amp;ps);
			EndPaint(hwnd,&amp;ps);
			return(0);
		}
		break;

		case WM_DESTROY: 
		{
			PostQuitMessage(0);
			return(0);
		}
		break;

		default:
		break;	
	}

	return(DefWindowProc(hwnd,msg,wparam,lparam));
}

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
{
	WNDCLASSEX	winclass;
	HWND		hwnd;
	MSG			msg;

	//Fenstereigenschaften festlegen:
	winclass.cbSize			 = sizeof(WNDCLASSEX);
	winclass.style			 = CS_HREDRAW | CS_VREDRAW;
	winclass.lpfnWndProc	         = WindowProc;
	winclass.cbClsExtra		 = 0;
	winclass.cbWndExtra		 = 0;
	winclass.hInstance		 = hinstance;
	winclass.hIcon			 = LoadIcon(NULL, IDI_APPLICATION);
	winclass.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	winclass.hbrBackground	         = (HBRUSH)GetStockObject(BLACK_BRUSH);
	winclass.lpszMenuName	         = NULL;
	winclass.lpszClassName	         = WINDOW_CLASS_NAME;
	winclass.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);

	hinstance_app = hinstance;

	if(!RegisterClassEx(&amp;winclass))
		return(0);

	if(!(hwnd = CreateWindowEx(NULL,WINDOW_CLASS_NAME,&quot;MEIN PROGRAMM&quot;, WS_POPUP | WS_VISIBLE, 0,0, 1024,768,NULL,NULL, hinstance, NULL)))
		return(0);

	main_window_handle = hwnd;

	while(TRUE)
	{
		if(PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))
		{
			if(msg.message == WM_QUIT)
				break;

			TranslateMessage(&amp;msg);

			DispatchMessage(&amp;msg);
		}

		//Programm_Hauptschleife();

	}

	return(msg.wParam);
}
</code></pre>
<p>Hier der Linkererror[beim erzeugen der Exe] (beim Kompilieren erhalte ich keine Fehler):</p>
<p>LIBCD.lib(crt0.obj) : error LNK2001: Nichtaufgeloestes externes Symbol _main<br />
Debug/main.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise<br />
Fehler beim Ausführen von link.exe.</p>
<p>Hoffe mir kann jmd. helfen</p>
<p>Lurnon</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173843/linker-error-_main</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 17:58:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173843.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Feb 2007 12:47:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Linker error (_main) on Tue, 20 Feb 2007 12:47:05 GMT]]></title><description><![CDATA[<p>Hallo,<br />
hoffe ich bin mit meiner Frage hier an der richtigen Stelle. Ich bin gerade dabei mir C++ beizubringen indem ich alte Programme von Delphi versuche nach C++ (VC++ Autorenversion) zu portieren, leider stehe ich erst ganz am Anfang. Hier nun der Code + Linker-meldung:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

 	{
			hdc = BeginPaint(hwnd,&amp;ps);
			EndPaint(hwnd,&amp;ps);
			return(0);
		}
		break;

		case WM_DESTROY: 
		{
			PostQuitMessage(0);
			return(0);
		}
		break;

		default:
		break;	
	}

	return(DefWindowProc(hwnd,msg,wparam,lparam));
}

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
{
	WNDCLASSEX	winclass;
	HWND		hwnd;
	MSG			msg;

	//Fenstereigenschaften festlegen:
	winclass.cbSize			 = sizeof(WNDCLASSEX);
	winclass.style			 = CS_HREDRAW | CS_VREDRAW;
	winclass.lpfnWndProc	         = WindowProc;
	winclass.cbClsExtra		 = 0;
	winclass.cbWndExtra		 = 0;
	winclass.hInstance		 = hinstance;
	winclass.hIcon			 = LoadIcon(NULL, IDI_APPLICATION);
	winclass.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	winclass.hbrBackground	         = (HBRUSH)GetStockObject(BLACK_BRUSH);
	winclass.lpszMenuName	         = NULL;
	winclass.lpszClassName	         = WINDOW_CLASS_NAME;
	winclass.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);

	hinstance_app = hinstance;

	if(!RegisterClassEx(&amp;winclass))
		return(0);

	if(!(hwnd = CreateWindowEx(NULL,WINDOW_CLASS_NAME,&quot;MEIN PROGRAMM&quot;, WS_POPUP | WS_VISIBLE, 0,0, 1024,768,NULL,NULL, hinstance, NULL)))
		return(0);

	main_window_handle = hwnd;

	while(TRUE)
	{
		if(PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))
		{
			if(msg.message == WM_QUIT)
				break;

			TranslateMessage(&amp;msg);

			DispatchMessage(&amp;msg);
		}

		//Programm_Hauptschleife();

	}

	return(msg.wParam);
}
</code></pre>
<p>Hier der Linkererror[beim erzeugen der Exe] (beim Kompilieren erhalte ich keine Fehler):</p>
<p>LIBCD.lib(crt0.obj) : error LNK2001: Nichtaufgeloestes externes Symbol _main<br />
Debug/main.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise<br />
Fehler beim Ausführen von link.exe.</p>
<p>Hoffe mir kann jmd. helfen</p>
<p>Lurnon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231905</guid><dc:creator><![CDATA[Lurnon]]></dc:creator><pubDate>Tue, 20 Feb 2007 12:47:05 GMT</pubDate></item><item><title><![CDATA[Reply to Linker error (_main) on Tue, 20 Feb 2007 12:49:01 GMT]]></title><description><![CDATA[<p>Falscher Projekttyp - du hast ein WinAPI-Programm (WinMain()) als Konsolenprogramm angelegt (letzteres benötigt die main() als Startpunkt).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231906</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 20 Feb 2007 12:49:01 GMT</pubDate></item><item><title><![CDATA[Reply to Linker error (_main) on Tue, 20 Feb 2007 12:49:55 GMT]]></title><description><![CDATA[<p>Irgendwie ist oben ein wenig Code verloren gegangen,<br />
das muss zwischen der 1. und der dritten Zeile stehen:</p>
<pre><code class="language-cpp">#define WINDOW_CLASS_NAME &quot;Shell Window&quot;
HWND      main_window_handle = NULL; 
HINSTANCE hinstance_app      = NULL; 

LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	PAINTSTRUCT ps;
	HDC			hdc;

	//Nachrichtenverarbeitung
	switch(msg) //case of
	{
		case WM_CREATE:	
		{
			return(0);
		}
		break;

		case WM_PAINT:
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1231907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231907</guid><dc:creator><![CDATA[Lurnon]]></dc:creator><pubDate>Tue, 20 Feb 2007 12:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to Linker error (_main) on Tue, 20 Feb 2007 14:09:57 GMT]]></title><description><![CDATA[<p>Vielen Dank für die schnelle Hilfe, es geht jetzt tadellos!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231985</guid><dc:creator><![CDATA[Lurnon]]></dc:creator><pubDate>Tue, 20 Feb 2007 14:09:57 GMT</pubDate></item></channel></rss>