public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Cannot compile using gcc (GetModuleHandleA error)
@ 2001-05-07  9:07 Troy Noble
  0 siblings, 0 replies; 2+ messages in thread
From: Troy Noble @ 2001-05-07  9:07 UTC (permalink / raw)
  To: 'Ajay Neti', cygwin; +Cc: ajaykumarn

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:ajaykumarn@hotmail.com ]
Sent: Monday, May 07, 2001 9:40 AM
To: cygwin@cygwin.com
Cc: ajaykumarn@infy.com
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Cannot compile using gcc (GetModuleHandleA error)
@ 2001-05-07  8:40 Ajay Neti
  0 siblings, 0 replies; 2+ messages in thread
From: Ajay Neti @ 2001-05-07  8:40 UTC (permalink / raw)
  To: cygwin; +Cc: ajaykumarn

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+0xe6)
:_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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-07  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-07  9:07 Cannot compile using gcc (GetModuleHandleA error) Troy Noble
  -- strict thread matches above, loose matches on Subject: below --
2001-05-07  8:40 Ajay Neti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).