Linking error 2019 unresolved external symbol _main ... 
Author Message
 Linking error 2019 unresolved external symbol _main ...

Hello,

  I've ported a VC6 Windows program in to Visual Studio.net VC7, beta
2.  It's a standard Windows program which includes windows.h and uses
"int WINAPI WinMain()" as the entry function.

  To make a long story short, I get the following linking error:

  "LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol
_main referenced in function _mainCRTStartup"

  I'm not sure what the problem is here.

  Btw,  previously I compiled a skeleton Windows Win32 application
using project wizard.  It would not compile, because the wingdi.h file
didn't have several necessary typedefs.  I had to include the wingdi.h
file from my VC++6 to get it to compile.  Has this been a common
error?

  Thanks for any help!
  ...John



Fri, 07 May 2004 04:38:32 GMT  
 Linking error 2019 unresolved external symbol _main ...
John,

Quote:

>   I've ported a VC6 Windows program in to Visual Studio.net VC7, beta
> 2.  It's a standard Windows program which includes windows.h and uses
> "int WINAPI WinMain()" as the entry function.

>   To make a long story short, I get the following linking error:

>   "LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol
> _main referenced in function _mainCRTStartup"

>   I'm not sure what the problem is here.

Look through your project settings for the Linker and change the Subsystem
from Console to Windows (/subsystem:console for /subsystem:windows).

Quote:

>   Btw,  previously I compiled a skeleton Windows Win32 application
> using project wizard.  It would not compile, because the wingdi.h file
> didn't have several necessary typedefs.  I had to include the wingdi.h
> file from my VC++6 to get it to compile.  Has this been a common
> error?

I wouldn't expect it to be, since the headers included by VC7 are much newer
than those in VC6. What was your code like?

--
Tomas Restrepo



Fri, 07 May 2004 05:28:25 GMT  
 Linking error 2019 unresolved external symbol _main ...

Quote:

> John,

  [...]

Quote:
> Look through your project settings for the Linker and change the Subsystem
> from Console to Windows (/subsystem:console for /subsystem:windows).

   Thanks for the help on the console/windows bit.

Quote:
> >   Btw,  previously I compiled a skeleton Windows Win32 application
> > using project wizard.  It would not compile, because the wingdi.h file
> > didn't have several necessary typedefs.  I had to include the wingdi.h
> > file from my VC++6 to get it to compile.  Has this been a common
> > error?
> I wouldn't expect it to be, since the headers included by VC7 are much newer
> than those in VC6. What was your code like?

  My code was simple the skeleton code created by the application
Wizard.  I added nothing to it.   I've placed the main code below.

  [START OF CODE]

// Gui.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "Gui.h"
#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                                                                // current instance
TCHAR szTitle[MAX_LOADSTRING];                                  // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];                    // the main window class name

// Forward declarations of functions included in this code module:
ATOM                            MyRegisterClass(HINSTANCE hInstance);
BOOL                            InitInstance(HINSTANCE, int);
LRESULT CALLBACK        WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK        About(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
        MSG msg;
        HACCEL hAccelTable;

        // Initialize global strings
        LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
        LoadString(hInstance, IDC_GUI, szWindowClass, MAX_LOADSTRING);
        MyRegisterClass(hInstance);

        // Perform application initialization:
        if (!InitInstance (hInstance, nCmdShow))
        {
                return FALSE;
        }

        hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_GUI);

        // Main message loop:
        while (GetMessage(&msg, NULL, 0, 0))
        {
                if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
                {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                }
        }

        return (int) msg.wParam;

Quote:
}

//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage are only necessary if you want this
code
//    to be compatible with Win32 systems prior to the
'RegisterClassEx'
//    function that was added to Windows 95. It is important to call
this function
//    so that the application will get 'well formed' small icons
associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
        WNDCLASSEX wcex;

        wcex.cbSize = sizeof(WNDCLASSEX);

        wcex.style                      = CS_HREDRAW | CS_VREDRAW;
        wcex.lpfnWndProc        = (WNDPROC)WndProc;
        wcex.cbClsExtra         = 0;
        wcex.cbWndExtra         = 0;
        wcex.hInstance          = hInstance;
        wcex.hIcon                      = LoadIcon(hInstance, (LPCTSTR)IDI_GUI);
        wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);
        wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);
        wcex.lpszMenuName       = (LPCTSTR)IDC_GUI;
        wcex.lpszClassName      = szWindowClass;
        wcex.hIconSm            = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

        return RegisterClassEx(&wcex);

Quote:
}

//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global
variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance,
NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;

Quote:
}

//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
        int wmId, wmEvent;
        PAINTSTRUCT ps;
        HDC hdc;

        switch (message)
        {
        case WM_COMMAND:
                wmId    = LOWORD(wParam);
                wmEvent = HIWORD(wParam);
                // Parse the menu selections:
                switch (wmId)
                {
                case IDM_ABOUT:
                        DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
                        break;
                case IDM_EXIT:
                        DestroyWindow(hWnd);
                        break;
                default:
                        return DefWindowProc(hWnd, message, wParam, lParam);
                }
                break;
        case WM_PAINT:
                hdc = BeginPaint(hWnd, &ps);
                // TODO: Add any drawing code here...
                EndPaint(hWnd, &ps);
                break;
        case WM_DESTROY:
                PostQuitMessage(0);
                break;
        default:
                return DefWindowProc(hWnd, message, wParam, lParam);
        }
        return 0;

Quote:
}

// Message handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
        switch (message)
        {
        case WM_INITDIALOG:
                return TRUE;

        case WM_COMMAND:
                if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
                {
                        EndDialog(hDlg, LOWORD(wParam));
                        return TRUE;
                }
                break;
        }
        return FALSE;

Quote:
}

   [END OF CODE]


Fri, 07 May 2004 13:34:17 GMT  
 Linking error 2019 unresolved external symbol _main ...
Hi John,

The code that the wizard creates compiles just fine with the current
headers. Can you post the exact list of errors you are getting?

-Ronald-



Quote:
> > John,

>   [...]

> > Look through your project settings for the Linker and change the
Subsystem
> > from Console to Windows (/subsystem:console for /subsystem:windows).

>    Thanks for the help on the console/windows bit.

> > >   Btw,  previously I compiled a skeleton Windows Win32 application
> > > using project wizard.  It would not compile, because the wingdi.h file
> > > didn't have several necessary typedefs.  I had to include the wingdi.h
> > > file from my VC++6 to get it to compile.  Has this been a common
> > > error?

> > I wouldn't expect it to be, since the headers included by VC7 are much
newer
> > than those in VC6. What was your code like?

>   My code was simple the skeleton code created by the application
> Wizard.  I added nothing to it.   I've placed the main code below.

>   [START OF CODE]

> // Gui.cpp : Defines the entry point for the application.
> //

> #include "stdafx.h"
> #include "Gui.h"
> #define MAX_LOADSTRING 100

> // Global Variables:
> HINSTANCE hInst; // current instance
> TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
> TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name

> // Forward declarations of functions included in this code module:
> ATOM MyRegisterClass(HINSTANCE hInstance);
> BOOL InitInstance(HINSTANCE, int);
> LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
> LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);

> int APIENTRY _tWinMain(HINSTANCE hInstance,
>                      HINSTANCE hPrevInstance,
>                      LPSTR     lpCmdLine,
>                      int       nCmdShow)
> {
>   // TODO: Place code here.
> MSG msg;
> HACCEL hAccelTable;

> // Initialize global strings
> LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
> LoadString(hInstance, IDC_GUI, szWindowClass, MAX_LOADSTRING);
> MyRegisterClass(hInstance);

> // Perform application initialization:
> if (!InitInstance (hInstance, nCmdShow))
> {
> return FALSE;
> }

> hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_GUI);

> // Main message loop:
> while (GetMessage(&msg, NULL, 0, 0))
> {
> if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
> {
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> }

> return (int) msg.wParam;
> }

> //
> //  FUNCTION: MyRegisterClass()
> //
> //  PURPOSE: Registers the window class.
> //
> //  COMMENTS:
> //
> //    This function and its usage are only necessary if you want this
> code
> //    to be compatible with Win32 systems prior to the
> 'RegisterClassEx'
> //    function that was added to Windows 95. It is important to call
> this function
> //    so that the application will get 'well formed' small icons
> associated
> //    with it.
> //
> ATOM MyRegisterClass(HINSTANCE hInstance)
> {
> WNDCLASSEX wcex;

> wcex.cbSize = sizeof(WNDCLASSEX);

> wcex.style = CS_HREDRAW | CS_VREDRAW;
> wcex.lpfnWndProc = (WNDPROC)WndProc;
> wcex.cbClsExtra = 0;
> wcex.cbWndExtra = 0;
> wcex.hInstance = hInstance;
> wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_GUI);
> wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
> wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
> wcex.lpszMenuName = (LPCTSTR)IDC_GUI;
> wcex.lpszClassName = szWindowClass;
> wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

> return RegisterClassEx(&wcex);
> }

> //
> //   FUNCTION: InitInstance(HANDLE, int)
> //
> //   PURPOSE: Saves instance handle and creates main window
> //
> //   COMMENTS:
> //
> //        In this function, we save the instance handle in a global
> variable and
> //        create and display the main program window.
> //
> BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
> {
>    HWND hWnd;

>    hInst = hInstance; // Store instance handle in our global variable

>    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
>       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance,
> NULL);

>    if (!hWnd)
>    {
>       return FALSE;
>    }

>    ShowWindow(hWnd, nCmdShow);
>    UpdateWindow(hWnd);

>    return TRUE;
> }

> //
> //  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
> //
> //  PURPOSE:  Processes messages for the main window.
> //
> //  WM_COMMAND - process the application menu
> //  WM_PAINT - Paint the main window
> //  WM_DESTROY - post a quit message and return
> //
> //
> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
> LPARAM lParam)
> {
> int wmId, wmEvent;
> PAINTSTRUCT ps;
> HDC hdc;

> switch (message)
> {
> case WM_COMMAND:
> wmId    = LOWORD(wParam);
> wmEvent = HIWORD(wParam);
> // Parse the menu selections:
> switch (wmId)
> {
> case IDM_ABOUT:
> DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
> break;
> case IDM_EXIT:
> DestroyWindow(hWnd);
> break;
> default:
> return DefWindowProc(hWnd, message, wParam, lParam);
> }
> break;
> case WM_PAINT:
> hdc = BeginPaint(hWnd, &ps);
> // TODO: Add any drawing code here...
> EndPaint(hWnd, &ps);
> break;
> case WM_DESTROY:
> PostQuitMessage(0);
> break;
> default:
> return DefWindowProc(hWnd, message, wParam, lParam);
> }
> return 0;
> }

> // Message handler for about box.
> LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM
> lParam)
> {
> switch (message)
> {
> case WM_INITDIALOG:
> return TRUE;

> case WM_COMMAND:
> if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
> {
> EndDialog(hDlg, LOWORD(wParam));
> return TRUE;
> }
> break;
> }
> return FALSE;
> }

>    [END OF CODE]



Fri, 07 May 2004 15:57:03 GMT  
 Linking error 2019 unresolved external symbol _main ...

Quote:
> Hi John,

> The code that the wizard creates compiles just fine with the current
> headers. Can you post the exact list of errors you are getting?

> -Ronald-

   Sure, Ronald.    Here is the list of errors I had. It did compile
with the old 1998 versions of wingdi.h, shellapi.h and wtypes.h, but
not with the 2001 files.

  Regards,
  ...John

------ Rebuild All started: Project: Gui, Configuration: Debug Win32
------

Deleting intermediate files and output files for project 'Gui',
configuration 'Debug|Win32'.
Compiling...
stdafx.cpp
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(1948) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(1949) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(1991) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(1996) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2007) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2008) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2012) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2013) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2019) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2024) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2025) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2044) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2045) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2058) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2060) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2078) : error C2061: syntax error :
identifier 'LPPIXELFORMATDESCRIPTOR'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2084) : error C2061: syntax error :
identifier 'LPDEVMODE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2086) : error C2061: syntax error :
identifier 'LPDEVMODE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2164) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2166) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2177) : error C2061: syntax error :
identifier 'LPLOGFONTA'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2178) : error C2061: syntax error :
identifier 'LPLOGFONTW'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2212) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2254) : error C2061: syntax error :
identifier 'LPABC'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2255) : error C2061: syntax error :
identifier 'LPABC'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2261) : error C2061: syntax error :
identifier 'LPABCFLOAT'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2262) : error C2061: syntax error :
identifier 'LPABCFLOAT'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2274) : error C2061: syntax error :
identifier 'LPBITMAPINFO'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2276) : error C2061: syntax error :
identifier 'LPGLYPHMETRICS'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2277) : error C2061: syntax error :
identifier 'LPGLYPHMETRICS'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2299) : error C2061: syntax error :
identifier 'LPOUTLINETEXTMETRICA'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2300) : error C2061: syntax error :
identifier 'LPOUTLINETEXTMETRICW'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2309) : error C2061: syntax error :
identifier 'LPPALET{*filter*}TRY'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : error C2065:
'LPRASTERIZER_STATUS' : undeclared identifier
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : error C2275: 'UINT' : illegal
use of this type as an expression
        c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\windef.h(162) : see declaration of 'UINT'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : warning C4229: anachronism
used : modifiers on data are ignored
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : error C2491:
'GetRasterizerCaps' : definition of dllimport data not allowed
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : error C2078: too many
initializers
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2313) : error C2275: 'UINT' : illegal
use of this type as an expression
        c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\windef.h(162) : see declaration of 'UINT'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2315) : error C2061: syntax error :
identifier 'LPRGNDATA'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2319) : error C2061: syntax error :
identifier 'LPPALET{*filter*}TRY'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2386) : error C2061: syntax error :
identifier 'LPFONTSIGNATURE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2387) : error C2061: syntax error :
identifier 'LPCHARSETINFO'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2389) : error C2061: syntax error :
identifier 'LPGCP_RESULTSA'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2390) : error C2061: syntax error :
identifier 'LPGCP_RESULTSW'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2603) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2604) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2639) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2641) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2652) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2655) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2660) : error C2143: syntax error :
missing ',' before '*'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2744) : error C2061: syntax error :
identifier 'LPHANDLETABLE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2745) : error C2061: syntax error :
identifier 'HANDLETABLE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(2748) : error C2061: syntax error :
identifier 'HANDLETABLE'
c:\Program Files\Microsoft Visual
Studio.NET\Vc7\include\wingdi.h(4126) : fatal error C1004: unexpected
end of file found

Build log was saved at
"file://c:\John\Projects\Gui\Debug\BuildLog.htm"
Gui - 55 error(s), 1 warning(s)

---------------------- Done ----------------------

    Rebuild All: 0 succeeded, 1 failed, 0 skipped



Sat, 08 May 2004 06:20:18 GMT  
 Linking error 2019 unresolved external symbol _main ...
You must just have a broken file.

In fact, it should be coming from the C:\Program Files\Microsoft Visual
Studio .NET\Vc7\PlatformSDK\Include directory

(as I thought it already was in Beta 2).

-Ronald-



Quote:
> > Hi John,

> > The code that the wizard creates compiles just fine with the current
> > headers. Can you post the exact list of errors you are getting?

> > -Ronald-

>    Sure, Ronald.    Here is the list of errors I had. It did compile
> with the old 1998 versions of wingdi.h, shellapi.h and wtypes.h, but
> not with the 2001 files.

>   Regards,
>   ...John

> ------ Rebuild All started: Project: Gui, Configuration: Debug Win32
> ------

> Deleting intermediate files and output files for project 'Gui',
> configuration 'Debug|Win32'.
> Compiling...
> stdafx.cpp
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(1948) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(1949) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(1991) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(1996) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2007) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2008) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2012) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2013) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2019) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2024) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2025) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2044) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2045) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2058) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2060) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2078) : error C2061: syntax error :
> identifier 'LPPIXELFORMATDESCRIPTOR'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2084) : error C2061: syntax error :
> identifier 'LPDEVMODE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2086) : error C2061: syntax error :
> identifier 'LPDEVMODE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2164) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2166) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2177) : error C2061: syntax error :
> identifier 'LPLOGFONTA'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2178) : error C2061: syntax error :
> identifier 'LPLOGFONTW'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2212) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2254) : error C2061: syntax error :
> identifier 'LPABC'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2255) : error C2061: syntax error :
> identifier 'LPABC'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2261) : error C2061: syntax error :
> identifier 'LPABCFLOAT'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2262) : error C2061: syntax error :
> identifier 'LPABCFLOAT'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2274) : error C2061: syntax error :
> identifier 'LPBITMAPINFO'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2276) : error C2061: syntax error :
> identifier 'LPGLYPHMETRICS'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2277) : error C2061: syntax error :
> identifier 'LPGLYPHMETRICS'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2299) : error C2061: syntax error :
> identifier 'LPOUTLINETEXTMETRICA'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2300) : error C2061: syntax error :
> identifier 'LPOUTLINETEXTMETRICW'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2309) : error C2061: syntax error :
> identifier 'LPPALET{*filter*}TRY'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : error C2065:
> 'LPRASTERIZER_STATUS' : undeclared identifier
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : error C2275: 'UINT' : illegal
> use of this type as an expression
>         c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\windef.h(162) : see declaration of 'UINT'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : warning C4229: anachronism
> used : modifiers on data are ignored
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : error C2491:
> 'GetRasterizerCaps' : definition of dllimport data not allowed
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : error C2078: too many
> initializers
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2313) : error C2275: 'UINT' : illegal
> use of this type as an expression
>         c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\windef.h(162) : see declaration of 'UINT'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2315) : error C2061: syntax error :
> identifier 'LPRGNDATA'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2319) : error C2061: syntax error :
> identifier 'LPPALET{*filter*}TRY'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2386) : error C2061: syntax error :
> identifier 'LPFONTSIGNATURE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2387) : error C2061: syntax error :
> identifier 'LPCHARSETINFO'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2389) : error C2061: syntax error :
> identifier 'LPGCP_RESULTSA'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2390) : error C2061: syntax error :
> identifier 'LPGCP_RESULTSW'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2603) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2604) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2639) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2641) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2652) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2655) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2660) : error C2143: syntax error :
> missing ',' before '*'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2744) : error C2061: syntax error :
> identifier 'LPHANDLETABLE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2745) : error C2061: syntax error :
> identifier 'HANDLETABLE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(2748) : error C2061: syntax error :
> identifier 'HANDLETABLE'
> c:\Program Files\Microsoft Visual
> Studio.NET\Vc7\include\wingdi.h(4126) : fatal error C1004: unexpected
> end of file found

> Build log was saved at
> "file://c:\John\Projects\Gui\Debug\BuildLog.htm"
> Gui - 55 error(s), 1 warning(s)

> ---------------------- Done ----------------------

>     Rebuild All: 0 succeeded, 1 failed, 0 skipped



Sat, 08 May 2004 12:12:11 GMT  
 Linking error 2019 unresolved external symbol _main ...

Quote:
> You must just have a broken file.
> In fact, it should be coming from the C:\Program Files\Microsoft Visual
> Studio .NET\Vc7\PlatformSDK\Include directory
> (as I thought it already was in Beta 2).
> -Ronald-

  Yes, when I include that directory using the /I option it works just
fine.  I note that the INCLUDE (and LIB) environment variable(s) in
the Registry is another directory entirely.  Not sure why.

  Btw, I compiled another of my imported Windows applications (I
pasted the source at the bottom of this file), and then ran it.  Upon
running it, I get the following errors:

[ERROR LIST]

'Gui2.exe': Loaded 'C:\John\Projects\Gui2\Debug\Gui2.exe', Symbols
loaded.
'Gui2.exe': Loaded 'C:\WINNT\SYSTEM32\NTDLL.DLL', Cannot find or open
a required DBG file.
'Gui2.exe': Loaded 'C:\WINNT\SYSTEM32\USER32.DLL', Cannot find or open
a required DBG file.
'Gui2.exe': Loaded 'C:\WINNT\SYSTEM32\KERNEL32.DLL', Cannot find or
open a required DBG file.
'Gui2.exe': Loaded 'C:\WINNT\SYSTEM32\GDI32.DLL', Cannot find or open
a required DBG file.
First-chance exception at 0x77e2fe4f in Gui2.exe: 0xC0000005: Access
violation reading location 0xcccccccc.
Unhandled exception at 0x77e2fe4f in Gui2.exe: 0xC0000005: Access
violation reading location 0xcccccccc.
First-chance exception at 0x77e2fe4f in Gui2.exe: 0xC0000005: Access
violation reading location 0xcccccccc.
Unhandled exception at 0x77e2fe4f in Gui2.exe: 0xC0000005: Access
violation reading location 0xcccccccc.
The program '[1776] Gui2.exe: Native' has exited with code 128 (0x80).

[/ERROR LIST]

 Is there some reason it can't find that DBG file?  I assume that's
the reason for the exception handling problems.   Is it a compiler
option?

  Thanks for any help!

  ...John

[SOURCE CODE]

#include <windows.h>
#include <cstring>
#include <cstdio>

LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);

char szWinName[] = "MyWin"; // name of window class

char str[255] = ""; // hods output string

int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
                                        LPSTR lpszArgs, int nWinMode)
{
        HWND hwnd;
        MSG msg;
        WNDCLASSEX wcl;

        // Define a window class.
        wcl.cbSize = sizeof(WNDCLASSEX);

        wcl.hInstance = hThisInst; // handle to this instance
        wcl.lpszClassName = szWinName;  // window class name
        wcl.lpfnWndProc = WindowFunc;  // window function
        wcl.style = 0;  // default style

        wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);  //large icon
        wcl.hIconSm = NULL; // use small version of large icon
        wcl.hCursor = LoadCursor(NULL, IDC_ARROW);  // cursor style

        wcl.lpszClassName = NULL;  // no class menu
        wcl.cbClsExtra = 0;  // no extra memory needed
        wcl.cbWndExtra = 0;

        // Make the window background white.
        wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

        // Register the window class.
        if(!RegisterClassEx(&wcl)) return 0;

        /* Now that a window class has been registered, a window can be
                created. */
        hwnd = CreateWindow(
                szWinName, // name of window class
                "Processing WM_CHAR Messages", // title
                WS_OVERLAPPEDWINDOW, // window style - normal
                CW_USEDEFAULT, // X coordinate - let Windows decide
                CW_USEDEFAULT, // Y coordinate - let Windows decide
                CW_USEDEFAULT, // width - let Windows decide
                CW_USEDEFAULT, // height - let Windows decide
                NULL, // no parent window
                NULL, // no menu
                hThisInst, // instance handle
                NULL // no additional arguments
        );

        // Display the Window
        ShowWindow(hwnd, nWinMode);
        UpdateWindow(hwnd);

        // Create the message loop.
        while( GetMessage(&msg, NULL, 0, 0) )
        {
                TranslateMessage(&msg); // translate keyboard messages
                DispatchMessage(&msg); // return control to Windows 2000
        }
        return msg.wParam;

Quote:
}

/* This function is called by Windows 2000 and is passed messages
        from the message queue.
*/
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message,
                                                        WPARAM wParam, LPARAM lParam)
{
        switch(message) {
                case WM_CHAR: // process key stroke
                        sprintf(str, "Character is %c", (char) wParam);
                        MessageBox(hwnd, str, "WM_CHAR Received", MB_OK);
                        break;
                case WM_DESTROY:  // terminate the program
                        PostQuitMessage(0);
                        break;
                default:
                        /* Let Windows 2000 process any messages not specified in
                                the preceding switch statement. */
                        return DefWindowProc(hwnd, message, wParam, lParam);
        }
        return 0;

Quote:
}

[/SOURCE CODE]


Sun, 09 May 2004 03:13:36 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Linking error 2019 unresolved external symbol _main when porting to .NET

2. Linking Problem when trying to create ReleaseUMinDependency[error LNK2001: unresolved external symbol _main]

3. Link error.(unresolved external symbol _main)

4. Error LNK20001 unresolved external symbol main.

5. error LNK2001: unresolved external symbol _main

6. error LNL2001 : unresolved external symbol _main

7. release build error LNK2001: unresolved external symbol _main

8. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

9. LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

10. error LNK2001: unresolved external symbol _main

11. error LNL2001 : unresolved external symbol _main

12. error message unresolved external symbol _main

 

 
Powered by phpBB® Forum Software