delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Message-ID: | <54726.1286459553@cc.hs-owl.de> |
To: | <cygwin AT cygwin DOT com> |
Reply-To: | <Michael DOT Jaeger AT hs-owl DOT de> |
X-Origin: | 194.94.231.186 |
X-Atmail-Account: | lep-ndh AT cc DOT hs-owl DOT de |
Date: | Thu, 7 Oct 2010 15:52:33 +0200 |
Subject: | Simple Cygwin Application Linking Problem |
From: | =?utf-8?B?IE1pY2hhZWwgSsOkZ2Vy?= <Michael DOT Jaeger AT hs-owl DOT de> |
X-Skim-SendBy: | exchange.hs-owl.de on Thu, 07 Oct 2010 15:52:34 +0200 |
X-SA-Exim-Connect-IP: | 193.174.118.179 |
X-SA-Exim-Mail-From: | michael DOT jaeger AT hs-owl DOT de |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Hello, I=E2=80=99m pretty new to this whole Cygwin stuff and I have a problem buil= ding an application to an executable. So let=E2=80=99s start with my little c program. #include <test.h> int main (void){ printf("Hello World"); test(); return 0; =20=20=20=20=20=20 } int test(void){ return 0; } My header file is pretty simple and looks like this. int main(void); int test(); I just included it for screwing around with makefiles and using files that = are not in the same directory, so that I had to work with path declarations. My makefile looks as follows: #INCLUDES ABSOLUTE INCNETSNMPABS =3D C:/cygwin/home/MJaeger/net-snmp-5.5/include=20=20=20 INCCYGSTDABS =3D C:/cygwin/usr/include=20=20=20=20=20=20=20=20=20=20= =20=20=20 #INCLUDES RELATIVE TO MAKEFILE=20 SOURCEHEADERREL =3D ../Headers/ #INCLUDE HEADER COMPILATION HCOMP =3D -I$(INCNETSNMPABS) -I$(INCCYGSTDABS) -I$(SOURCEHEADER= REL) #SOURCES RELATIVE TO MAKEFILE SOURCEFILEREL =3D ../Source/test.c #LIBRARIES ABSOLUTE LIBNETSNMPABS =3D C:/cygwin/home/MJaeger/net-snmp-5.5/snmplib/ LIBCYGW32APIABS =3D C:/cygwin/lib/w32api LIBCYGSTDABS =3D C:/cygwin/usr/include/d/3.4.4/std/c LIBCYGDLLABS =3D C:/cygwin/bin #LINKER LIBRARY COMPILATION LCOMP =3D -L $(LIBNETSNMPABS) -L $(LIBCYGW32APIABS) -L $(LIBCYGSTDABS) -L $= (LIBCYGDLLABS)=20=20 target.o: $(SOURCEFILEREL) $(SOURCEHEADERREL)/test.h gcc -o target.o $(HCOMP) -c $(SOURCEFILEREL)=20=20 =20=20=20=20=20=20 test.exe: target.o ld $(LCOMP) target.o When calling make target.o, no error occurs. The file is created and everyt= hing seems fine. But when I=E2=80=99m calling make test.exe the following e= rror occurs: target.o:test.c(.text+0x12): undefined reference to =E2=80=98__main=E2=80= =99 target.o:test.c(.text+0x1e): undefined reference to =E2=80=98printf=E2=80= =99 make: *** [test.exe] Error 1 As I said I=E2=80=99m pretty new to this Cygwin stuff and I=E2=80=99m also = new to writing makefiles, that=E2=80=99s why I just want to create a simple= example. To me it seems that the linker does not know enough library files.=20 Another problem is of course, since I=E2=80=99m not so familiar with this s= tuff, I=E2=80=99m not even sure what to search for, so maybe someone can pr= ovide me with new knowledge or give me some hints so that I know in which t= opic, or sub topic I have to gain more knowledge. Cheers and regards Michael =20 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |