delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/17/01:43:51

From: pdasilva AT mail DOT telepac DOT pt ("=?ISO-8859-1?Q?Paulo_S=E9rgio_Caetano_da_Silva?=")
Subject: Problems with mingw32.
17 Jan 1997 01:43:51 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199701170208.CAA00174.cygnus.gnu-win32@mail.telepac.pt>
Mime-Version: 1.0
Original-To: <gnu-win32 AT cygnus DOT com>
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi,
After a tricky installation of mingw32 over a previous
cygnus gcc (last version, I can't remember what is it now)
I tried to compile the included program. Compilation
itself runs fine, with no errors/warnings at all.
The link issued lots of windows related names as undefined.
Then I decided to include -luser32. Only rests an
undefined symbol name - `GetStockObject AT 4'. 
What library is missing? Would anybody
enlight me about the warnings also issued?

TIA

Here is the pertinent info...

===>The gcc link command line
gcc -o olawin.exe $LIBRARY_PATH/crt0.o olawin.o -lmingw32 -lgcc -lcrtdll
-luser32 -lkernel32

===>Messages I got
/usr/i386-cygwin32/lib/crt0.o(.data+0x0):crt0.c: multiple definition of
`stdin'
/usr/i386-cygwin32/lib/crt0.o(.data+0x0):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.data+0x4):crt0.c: multiple definition of
`stdout'
/usr/i386-cygwin32/lib/crt0.o(.data+0x4):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.data+0x8):crt0.c: multiple definition of
`stderr'
/usr/i386-cygwin32/lib/crt0.o(.data+0x8):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.data+0xc):crt0.c: multiple definition of
`__argc'
/usr/i386-cygwin32/lib/crt0.o(.data+0xc):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.data+0x10):crt0.c: multiple definition of
`__argv'
/usr/i386-cygwin32/lib/crt0.o(.data+0x10):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.data+0x14):crt0.c: multiple definition of
`_environ'
/usr/i386-cygwin32/lib/crt0.o(.data+0x14):crt0.c: first defined here
/usr/i386-cygwin32/lib/crt0.o(.text+0x0):crt0.c: multiple definition of
`mainCRTStartup'
/usr/i386-cygwin32/lib/crt0.o(.text+0x0):crt0.c: first defined here
ld: warning: cannot find entry symbol _WinMainCRTStartup; defaulting to
00401000
olawin.o(.text+0x63):olawin.c: undefined reference to `GetStockObject AT 4'


===>The source - olawin.c
#include <windows.h>

long FAR PASCAL _export ProcJan (HWND, UINT, UINT, LONG) ;

int PASCAL WinMain (HANDLE hCopia, HANDLE hCopiaAnterior,
                    LPSTR  lpszParamCmd, int nCmdMostrar)
     {
     static char szNomeAplic[] = "OlaWin" ;
     HWND        hjan ;
     MSG         msg ;
     WNDCLASS    classejan ;

     if (!hCopiaAnterior)
          {
          classejan.style         = CS_HREDRAW | CS_VREDRAW ;
          classejan.lpfnWndProc   = ProcJan ;
          classejan.cbClsExtra    = 0 ;
          classejan.cbWndExtra    = 0 ;
          classejan.hInstance     = hCopia ;
          classejan.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
          classejan.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
          classejan.hbrBackground = GetStockObject (WHITE_BRUSH) ;
          classejan.lpszMenuName  = NULL ;
          classejan.lpszClassName = szNomeAplic ;

          RegisterClass (&classejan) ;
          }

     hjan = CreateWindow (szNomeAplic,   // nome da classe da janela
                    "Programa OLA'",     //  titulo da janela
                    WS_OVERLAPPEDWINDOW, //  estilo da janela
                    CW_USEDEFAULT,       //  posicao x inicial
                    CW_USEDEFAULT,       // posicao y inicial
                    CW_USEDEFAULT,       // tamanho x inicial
                    CW_USEDEFAULT,       // tamanho y inicial
                    NULL,                // handle da janela-mae
                    NULL,                // handle do menu da janela
                    hCopia,              // handle da copia do programa
                    NULL) ;              // parametros de criacao

     ShowWindow (hjan, nCmdMostrar) ;
     UpdateWindow (hjan) ;

     while (GetMessage (&msg, NULL, 0, 0))
          {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
          }
     return msg.wParam ;
     }

long FAR PASCAL _export ProcJan (HWND hjan, UINT mensagem, UINT wParam,
                                                           LONG lParam)
     {
     HDC         hdc ;
     PAINTSTRUCT ps ;
     RECT        retang ;

     switch (mensagem)
          {
          case WM_PAINT:
               hdc = BeginPaint (hjan, &ps) ;

               GetClientRect (hjan, &retang) ;

               DrawText (hdc, "Ola', Windows!", -1, &retang,
                         DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;

               EndPaint (hjan, &ps) ;
               return 0 ;

          case WM_DESTROY:
               PostQuitMessage (0) ;
               return 0 ;
          }

     return DefWindowProc (hjan, mensagem, wParam, lParam) ;
     }

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019