windows.h linker problem

Im working with the book Begining DirectX9.

Using Dev-Cpp here. I get this linker error:
[Linker error] undefined reference to `initWindow(HINSTANCE__*)'

So is there something im doing wrong? Is it the compiler?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <windows.h>

HINSTANCE hInst;
HWND wndHandle;

bool initWindow(HINSTANCE hInstance);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

/* winmain.cpp function that initializes the window and the message loop that checks for user input or
system messages, the program will then call the TranslateMessage and DispatchMessage functions.*/ 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    //Intialize the window
    if (!initWindow (hInstance) )
    return false;
    
    //Main message loop
    MSG msg;
    ZeroMemory (&msg, sizeof (msg) );
    while(msg.message!=WM_QUIT)
    {
                               while (GetMessage(&msg, wndHandle, 0, 0) )
                               {
                                     TranslateMessage(&msg);
                                     DispatchMessage(&msg);
                                     
                                     }
                                     }
                                     return(int)msg.wParam;
                                     }
                                     
/* Creating the class for which the window will be intialized. Windows Programming requires a class to be registered before
a window is created. */

bool initWindows(HINSTANCE hInstance)
{
     WNDCLASSEX wcex;
     
     //How the window will look to the system
     wcex.cbSize=sizeof(WNDCLASSEX);                           //Size of the Structure
     wcex.style=CS_HREDRAW | CS_VREDRAW;                       //The class style
     wcex.lpfnWndProc=(WNDPROC)WndProc;                        //The window procedure callback
     wcex.cbClsExtra=0;                                        //Extra bytes to allocate for this class
     wcex.cbWndExtra=0;                                        //Extra bytes to allocate for this instance
     wcex.hInstance=hInstance;                                 //handle to the application for this instance
     wcex.hIcon=0;                                             //icon to associate with the application
     wcex.hCursor=LoadCursor(NULL, IDC_ARROW);                 //the default cursor
     wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);              //the background color
     wcex.lpszMenuName=NULL;                                   //the resource name for the menu
     wcex.lpszClassName="DirectXExample";                      //the class name being created
     wcex.hIconSm=0;                                           //the handle to the small icon
     RegisterClassEx(&wcex);
     
     //Create the window
     wndHandle=CreateWindow(
                            "DirectXExample",                  //the window class to use
                            "DirectXExample",                  //the title bar text
                            WS_OVERLAPPEDWINDOW,               //the window style
                            CW_USEDEFAULT,                     //the starting x coordinate
                            CW_USEDEFAULT,                     //the starting y coordinate
                            640,                               //the pixel width of the window
                            480,                               //the pixel height of the window
                            NULL,                              //the parent window; NULL for desktop
                            NULL,                              //the menu for the application; NULL for none
                            hInstance,                         //the handle to the application instance
                            NULL);                             //No values passed to the window
                            
     //Make sure that the window handle that is created is valid
     if (!wndHandle)
        return false;
        
     //Display the window on the screen
     ShowWindow(wndHandle, SW_SHOW);
     UpdateWindow(wndHandle);
     return true;
     }
     
     LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// Check any available messages from the queue
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
// Always return the message to the default window
// procedure for further processing
return DefWindowProc(hWnd, message, wParam, lParam);
}
                            
                                     
Last edited on
You've used:
1
2
initWindow
initWindows
O wow, all about those little details huh? I know its been a while but thank you anyways!
Topic archived. No new replies allowed.