Subject: RE: Cannot compile using gcc (GetModuleHandleA error)
From: Troy Noble <[email-masked]>
To: "'Ajay Neti'" <[email-masked]>, [email-masked]
Cc: [email-masked]
Date: Mon, 7 May 2001 10:07:02 -0600

If you installed all the packages using setup.exe, compiles should work
"just like
unix" for the type of program you are trying to compile.  You don't need to
explicitly specify the cygwin library in most cases, and even if you did,
the
better way to do it is with -lcygwin rather than specifying the explicit
path
to the libcygwin.a file.

Start up a bash shell by clicking on the Cygwin icon on your
desktop  (I noticed you were running cmd.exe?  why?  should
work either way, but bash is so much nicer ;-> )

.../tmp$ gcc tmp.c -o tmp
.../tmp$ ./tmp.exe
.../tmp$ echo $?
0
.../tmp$ cat tmp.c
int main(int argc, char** argv) {
        int a= 3+2;
        return 0;
}

If you're curious what default include directories, lib directories,
libraries, etc are being used by the compiler you can use:

$ gcc --verbose tmp.c -o tmp

to see what's really going on.  In there you'll see why you don't have to
explicitly specify things like -I/usr/include -L/usr/lib -lcygwin for
example.

Troy

-----Original Message-----
From: Ajay Neti [mailto:[email-masked]]
Sent: Monday, May 07, 2001 9:40 AM
To: [email-masked]
Cc: [email-masked]
Subject: Cannot compile using gcc (GetModuleHandleA error)

Hi,

I have extracted the gcc zip file from cygwin site, and I am
trying to compile the following C file on Windows 98 :-

int main(int argc, char** argv) {
      int a= 3+2;
	return 0;
}

The compiler command I give and the error I get are :-

D:\dev>gcc -I D:\Cygnus\usr\include -L C:\Windows\System hello.c
/cygdrive/d/CYGNUS/USR/BIN/../lib/libcygwin.a(_cygwin_crt0_common.o)(.text+0
xe6)
:_cygwin_crt0_common.cc: undefined reference to `GetModuleHandleA@4'
collect2: ld returned 1 exit status

Any ideas on how to fix this?
I saw some of the archived messages on this mail list, and I
tried to link to various *32 libraries as indicated there, but I
always ended up with the same error.

Thanks a bunch,
Ajay

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple