Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Multiple Errors Compiling with Dev-C++
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
QuantumPhysics




PostPosted: Tue Dec 25, 2012 6:20 pm   Post subject: Multiple Errors Compiling with Dev-C++

main.cpp

code:


#define _WIN32_IE 0x0700
#include <cstdlib>
#include <windows.h>
#include "resource.h"

#pragma comment(lib, "comctl32.lib")

BOOL CALLBACK AppDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  switch(uMsg)
  {
  case WM_INITDIALOG:
    SetClassLongPtr(hDlg, GCLP_HICON, (long)LoadIcon(0, IDI_APPLICATION));
    return 1;
  case WM_COMMAND:
    switch(wParam)
    {
    case IDOK:
      return 0;
    case IDCANCEL:
      EndDialog(hDlg, 0);
    }
  }
  return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                LPSTR lpCommandPrompt, int nShowVisual)
{
  InitCommonControls();
  DialogBoxParam(hInstance, (LPCTSTR)IDD_DIALOG1, 0, AppDlgProc, 0);
  return 0;
}



resource.h

code:

#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#define IDD_DIALOG1                             100
#define IDI_ICON1                               102
#define IDOK                                    1000
#define IDC_PROGRESS1                           1001
#define IDC_CHECKBOX1                           1002
#define IDC_CHECKBOX2                           1003
#define IDOK1                                   1004



I get multiple errors when compiling the project. I need help solving these errors to be able to compile. I also need to ask, what the source of the error is and what it means.

Here is the error log my compiler gives me (in order):


5 C:\Users\Admin\Desktop\postgresSQL\main.cpp
7:1 C:\Users\Admin\Desktop\postgresSQL\resource.h
In file included from main.cpp [Warning] "IDOK" redefined
4 C:\Dev-Cpp\include\windows.h:55, from main.cpp
In file included from C:/Dev-Cpp/include/windows.h:55, from main.cpp
4 C:\Users\Admin\Desktop\postgresSQL\main.cpp from main.cpp
765:1 C:\Dev-Cpp\include\winuser.h [Warning] this is the location of the previous definition
C:\Users\Admin\Desktop\postgresSQL\main.cpp In function `BOOL AppDlgProc(HWND__*, UINT, WPARAM, LPARAM)':
14 C:\Users\Admin\Desktop\postgresSQL\main.cpp `GCLP_HICON' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
14 C:\Users\Admin\Desktop\postgresSQL\main.cpp `SetClassLongPtr' undeclared (first use this function)
C:\Users\Admin\Desktop\postgresSQL\main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
31 C:\Users\Admin\Desktop\postgresSQL\main.cpp `InitCommonControls' undeclared (first use this function)
C:\Users\Admin\Desktop\postgresSQL\Makefile.win [Build Error] [main.o] Error 1 [/code]

RE: If it helps, this is my .rc (resource file):

code:

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"

LANGUAGE 0, SUBLANG_NEUTRAL
IDD_DIALOG1 DIALOG 0, 0, 186, 142
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU
CAPTION "filler.........."
FONT 8, "Ms Shell Dlg"
{
    DEFPUSHBUTTON   "filler..........", IDOK, 100, 84, 69, 26
    CONTROL         "", IDC_PROGRESS1, PROGRESS_CLASS, 0, 13, 118, 156, 14
    ICON            IDI_ICON1, IDC_STATIC, 16, 12, 21, 20, SS_ICON
    AUTOCHECKBOX    "filler..........", IDC_CHECKBOX1, 55, 28, 74, 8
    AUTOCHECKBOX    "filler..........", IDC_CHECKBOX2, 55, 11, 66, 8
    DEFPUSHBUTTON   "filler..........", IDOK1, 15, 84, 70, 26
    LTEXT           "filler..........", IDC_STATIC, 11, 40, 169, 8, SS_LEFT
    LTEXT           "filler..........", IDC_STATIC, 11, 50, 155, 8, SS_LEFT
    LTEXT           "filler..........", IDC_STATIC, 11, 60, 156, 8, SS_LEFT
    LTEXT           "filler..........", IDC_STATIC, 11, 71, 152, 8, SS_LEFT
}

LANGUAGE 0, SUBLANG_NEUTRAL
IDI_ICON1          ICON           "icon2.ico"

LANGUAGE 0, SUBLANG_NEUTRAL
1                  RT_MANIFEST    ".\\manifest.xml"



Thanks,
Merry Christmas!
Sincerly ~ QP Canada
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Dec 26, 2012 11:31 am   Post subject: RE:Multiple Errors Compiling with Dev-C++

All the errors are undefined symbols. That just means you tried to use something that doesn't exist. Either you forgot to write it, or you forgot to include it, or you forgot to use a namespace. In this case, the function SetClassLongPtr() doesn't exist, its argument GCLP_HICON does not exist, and the function InitCommonControls does not exist.
QuantumPhysics




PostPosted: Thu Dec 27, 2012 1:38 am   Post subject: RE:Multiple Errors Compiling with Dev-C++

Oh, alright, thanks haha. I got it working.
I am so stupid aagh! I realized I opened the wrong file haha
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: