I have searched and deleted on this code, but I am still stumped on where the "unresolved external" it's complaining about is. Here is the code:

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <tchar.h>
#include "resource.h"

#define GETITEM(item) GetDlgItem(hWndDlg, item)

void convert (HWND hWndDlg)
{
    wchar_t ConvertTime[9], ETime[8], UKTime[8], HKTime[8], Hour[8], Min[8], AMPM[8];
    int intHour;

    // Gets the user entered time and converts it to usable format
    GetWindowTextW(GETITEM(IDC_CONVERT_TIME), ConvertTime, 9);
    _tcscpy(Hour, ConvertTime);
    _tcscpy(Min, ConvertTime + 3);
    _tcscpy(AMPM, ConvertTime + 6);
    intHour = _wtoi(Hour);

    if (_tcschr(ConvertTime, 'A') == NULL ||
        _tcschr(ConvertTime, 'P') == NULL ||
        _tcschr(ConvertTime, 'a') == NULL ||
        _tcschr(ConvertTime, 'p') == NULL)
    {
        // converting to 24hr format
        if (_tcschr(AMPM, 'P') != NULL && _tcschr(AMPM, 'p') != NULL)
        {
            if (intHour != 12)
            {
                intHour = intHour + 12;
            }
        }
        else if (_tcschr(AMPM, 'A') != NULL && _tcschr(AMPM, 'a') != NULL)
        {
            if (intHour == 12)
            {
                intHour = 0;
            }
        }
    }
}


LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg,
                         WPARAM wParam, LPARAM lParam)
{
    switch(Msg)
    {
    case WM_INITDIALOG:
        // Init radio button group.
        CheckRadioButton (hWndDlg,
                          // First and last of list of consecutive
                          // radio button id's.
                          IDC_EASTERN_SELECT, IDC_HK_SELECT,
                          // Id to set; all others are reset.
                          IDC_EASTERN_SELECT);
        return TRUE;

    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
        case IDC_CONVERT:
            convert (hWndDlg);
            return TRUE;

        case IDCANCEL:
            EndDialog(hWndDlg, 0);
            return TRUE;
        }
        break;
    }

    return FALSE;
}


int APIENTRY
WinMain (HINSTANCE hInst, HINSTANCE unused, LPSTR cmdLine, int cmdShow)
{
  DialogBox(hInst, MAKEINTRESOURCE(IDD_CONTROLS_DLG), 0,
            (DLGPROC)(DlgProc));
  return 0;
}

If anyone can find it and notify me, it would be very appreciated.

Recommended Answers

All 3 Replies

It would help if you posted the entire error message because following the text "unresolved external" is usually the name of the symbol it is unable to find.

the compiler was just complainig that there was no int main().

A-ha you are compiling and linking your program as a console application (which expects the entry to be int main()).

You need to compile and link it as a Windows application so that it expects the entry point to be WinMian.

You are either using the wrong project type in your IDE or you are using the wrong switches on your linker command line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.