Header files are not compiling

Oct 2, 2011 at 12:30pm
Hi there.

I'm having a problem with my windows project, because it the main.cpp is not compiling with the rest of the program..

I'll try to explain.
I've made a pseudo-command prompt using the windows api coding. It's a edit control window, another edit control window underneath it and a button to the side. That works perfectly fine.

*the command line processing is in a header file*
The command line takes what the user inputs and does stuff with it. That's all well and good; however, I made some changes to it (like not showing what the user inputs through a message box after they press enter) and when I compile it, the program runs as if I never made any changes.

I checked the project options and what not; thats normal. So I tried again; the same thing happened.

Then I deleted the entire header except for the variables, and it still compiles as if it's all there.

Can someone tell me why this is happening?

I'm using DEV C++ 4.9.9.2
Windows 7

The program looks something like this.. *note i have cut out some of it...*

Main.cpp
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

HBRUSH g_hbrbackground = CreateSolidBrush(RGB(0,0,0));
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)              
    {
           
           case WM_CTLCOLORDLG:
                return (LONG)g_hbrbackground;
           break;
           case WM_CTLCOLORSTATIC:
           {
               HDC hdcStatic = (HDC)wParam;                      
               SetTextColor(hdcStatic,RGB(170,0,0));
               SetBkMode(hdcStatic, TRANSPARENT);
               return (LONG)g_hbrbackground;                
           }
           break;
           case WM_CREATE:               
                HWND hEdit;//Main text Window//Main Input window
                HWND hEnterBut;
                HWND hContinue;
                hContinue = CreateWindowEx(NULL,"BUTTON","Continue",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 460,0,65,20,hwnd,(HMENU)IDC_CONTBUT,GetModuleHandle(NULL),NULL);
                hEnterBut = CreateWindowEx(NULL,"BUTTON","Enter",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 460,300,60,20,hwnd,(HMENU)IDC_ENTERBUT,GetModuleHandle(NULL),NULL);
                hEnterText = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","Enter Commands Here",WS_VISIBLE |WS_CHILD, 0,300,450,20, hwnd, (HMENU)IDC_ENTERTEXT,GetModuleHandle(NULL),NULL);
                hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT","Enter text here", WS_VISIBLE | WS_CHILD | ES_MULTILINE | ES_READONLY, 0, 0, 450, 280, hwnd,(HMENU)IDC_TEXT,GetModuleHandle(NULL),NULL);
                start_upmsg();//this was a header function
                SetDlgItemText(hwnd, IDC_TEXT, stuff);//'stuff' is a header variable, but it isn't defined so it shouldn't show anything, but it still does.
           break;
           case WM_COMMAND:
                switch(LOWORD(wParam)){
                case IDC_ENTERBUT:{
                      check_enterbox();//this was a header functino
                      break;}
                case IDC_CONTBUT:
                     break;
                case IDM_FILE_QUIT:
                    PostQuitMessage(0);
                    break; 
                case IDM_VIEW_STATS:
                     );
                     break;
        }
        break;
        case WM_DESTROY:
            PostQuitMessage (0);      
            break;
        default:                     
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}


Header file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

HWND hwnd;
HWND hEnterText;
char* junk;
char* stuff;
int start = 0;
struct human_def{
char name[12];
char rank[31];
int age;
int level;
int strength;    
};


Oct 3, 2011 at 2:44pm
can anyone help me?
Oct 3, 2011 at 3:16pm
If you delete everything except the variables, 'stuff' still exists. It's going to be nonsense and probably mess with your program, but it'll still compile.

If deleting the variables still doesn't trigger any errors, post again.
Oct 3, 2011 at 3:20pm
closed account (1vRz3TCk)
Could it be that the file that you have open in the IDE is not the same as the file that gets compiled?

PS DEV-C++ is not very good, maybe worth trying something else such as code::blocks
Topic archived. No new replies allowed.