Hi all,
I have a problem that just seems to pull my hair out.
I have researched the problem with msdn with no solution and your FAQ's solved half of one of the two errors.
Please find my code followed by the errors.
I am not after someone to solve the errors for me (otherwise you don't learn),just maybe a hint or a pointer in the near vicinity of the problem would be very much appreciated.
< 001 #include <Windows.h>
002 #include "resource.h"
003
004 /* Create controls */
005 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86'publicKeyToken='6595b64144ccf1df' language='*'\"")
006
007 /* Name of our class and the title */
008 const char *clsName = "WinAPI";
009 char *title = "Lord Dragonian Editor";
010
011 /* Global flag for our message loop */
012 bool running = true;
013
014 /* Handle to the window */
015 HWND hWnd = NULL;
016
017 /* Windows callback procedure. */
018 LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
019
020 /* Entry point of the application */
021 int WINAPIWinMain( HINSTANCE hInstance, /* A handle to the current instance of the application. */
022 HINSTANCE hPrevInstance, /* A handle to the previous instance of the application. */
023 LPSTR lpCmdLine, /* The command line for the application, excluding the program name. */
024 int nCmdShow) /* Controls how the window is to be shown. */
025 {
026 WNDCLASSEX WndEx;
027 MSG msg;
028
029 WndEx.cbSize = sizeof(WNDCLASSEX); /* The size, in bytes, of this structure. */
030 WndEx.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; /* The class style(s) */
031 WndEx.lpfnWndProc = (WNDPROC)WndProc; /* A pointer to the window procedure. */
032 WndEx.cbClsExtra = 0; /* The number of extra bytes to allocate following the window-class structure. */
033 WndEx.cbWndExtra = 0; /* The number of extra bytes to allocate following the window instance. */
034 WndEx.hIcon = LoadIcon(NULL, IDI_APPLICATION); /* A handle to the class icon. */
035 WndEx.hCursor = LoadCursor(NULL, IDC_ARROW); /* A handle to the class cursor. */
036 WndEx.hbrBackground = (HBRUSH)24,180,192,0,35; /* A handle to the class background brush. */
037 WndEx.lpszMenuName = MAKEINTRESOURCE(IDR_MAIN_MENU1); /* Create the menu from resource file */
038 WndEx.lpszClassName = clsName; /* A pointer to a string that contains the class name */
039 WndEx.hInstance = hInstance; /* A handle to the instance that contains the window procedure for the class. */
040 WndEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION); /* A handle to a small icon that is associated with the window class */
041
042 /* Register the windows class */
043 if (!RegisterClassEx(&WndEx))
044 {
045 MessageBox(NULL, "Welcome","Lord Dragonian Editor", MB_OK);
046 return 0;
047 }
048
049 /* Create the window */
050 if (!(hWnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, /* The extended window style */
051 clsName, /* A pointer to a string that contains the class name */
052 title, /* A pointer to a string that contains the title of the window */
053 WS_OVERLAPPEDWINDOW | /* The style of the window being created */
054 WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
055 250,100, /* initial x,y position of the window */
056 1163,630, /* initial x,y size of the window */
057 NULL, /* A handle to the parent or owner window */
058 NULL, /* A handle to a menu */
059 hInstance, /* A handle to the instance of the window */
060 NULL))) /* lParam */
061 {
062 MessageBox(NULL, "Failed to create the window", "ERROR", MB_OK);
063 return 0;
064 }
065
066 /* The window is initially hidden, we need to show it */
067 ShowWindow(hWnd, SW_SHOW);
068
069 /* The main message loop of the program */
070 while(running)
071 {
072 /* Are there any messages in the message queue? */
073 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
074 {
075 /* translate and dispatch the message */
076 TranslateMessage(&msg);
077 DispatchMessage(&msg);
078 }
079 }
080
081 return msg.wParam;
082 }
083
084 /* Windows callback procedure.*/
085 LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
086 {
087 switch (uMsg)
088 {
089 /* Message created when the user tries to close the window */
090 case WM_CLOSE:
091 DestroyWindow(hWnd);
092 return 0;
093
094 case WM_DESTROY:
095 PostQuitMessage(0);
096 running = false;
097 return 0;
098
099 case WM_COMMAND:
100 {
101 switch(LOWORD(wParam))
102 {
103 case IDM_EXIT_APP:
104 PostQuitMessage(0);
105 running = false;
106 break;
107 }
108
109 } break;
110
111 default:
112 return DefWindowProc(hWnd,uMsg,wParam,lParam);
113 }
114
115 } >
And the offending errors are:
Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\Users\John\Documents\Visual Studio 2010\Projects\Johns AIO\LBDEd32\LBDEd32\MSVCRTD.lib(crtexe.obj) LBDEd32
Error 2 error LNK1120: 1 unresolved externals C:\Users\John\Documents\Visual Studio 2010\Projects\Johns AIO\LBDEd32\Debug\LBDEd32.exe 1 1 LBDEd32
I know that the errors give me the path but that would be OK if the files existed but they don't.
Many thanks in advance
joejoemoe