Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-AuthUser: gerrit:koeln.convey.de Date: Sun, 8 Jun 2003 22:56:22 +0200 From: "Gerrit P. Haase" Organization: Esse keine toten Tiere X-Priority: 3 (Normal) Message-ID: <17358589684.20030608225622@familiehaase.de> To: "Hans Horn" CC: cygwin AT cygwin DOT com Subject: Re: undefined reference to '_... In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hallo Hans, Am Sonntag, 8. Juni 2003 um 19:22 schriebst du: > Hi folks, > I'm trying to port a collection of unix applications to cygwin, and in doing > so, I'm having a hard time to get the stuff to link. > It's a bunch of fortran and c sources, that call each other wildly. some > mains are in c, some mains are in fortran. > Compiling and archiving everything works like a charm, > When I'm trying to link the first executable (main in c) against the > libraries I have created, I get tons of undefined reference complaints, all > starting with '_', and all are non-system symbols. > I've confirmed by running nm on the libraries in question, that the missing > symbols are actually in the library. > The linker command is : > gcc -ofoo foomain.o -L../lib -lfoo1 -lfoo2 -lg2c -lc -lgsl -lm > Do I have to do something special to a libraries after archival of object > files, before I can link against it? > I'm probably doing something very stupid. > But since my head is already hurting from banging it against the concrete > wall for a while, I'd rather ask. > anybody any clues? It is not neccessary to link against libc and libm since they are the same as libcygwin (sysmlinks) and libcygwin is linked in automatically. Then it depends on the order. If libfoo1 needs a symbol from libfoo2 the linker doesn't find it (or was it the other way around?), try: gcc -o foo foomain.o -L../lib -lgsl -lg2c -lfoo2 -lfoo1 or other combinations since the order is important for the linker. Gerrit -- =^..^= -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/