delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/07/12:08:10

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <8F23E55D511AD5119A6800D0B76FDDE11E1015@cpex3.channelpoint.com>
From: Troy Noble <troy DOT noble AT channelpoint DOT com>
To: "'Ajay Neti'" <ajaykumarn AT hotmail DOT com>, cygwin AT cygwin DOT com
Cc: ajaykumarn AT infy DOT com
Subject: RE: Cannot compile using gcc (GetModuleHandleA error)
Date: Mon, 7 May 2001 10:07:02 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/)

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

- Raw text -


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