X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 05 Feb 2008 20:41:54 +0530 From: Anik Pal Subject: RE: RE: undefined reference to `_msgDebug' in GCC To: cygwin AT cygwin DOT com Message-id: <000701c86809$716073c0$af0ab7a3@mea.slb.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook, Build 10.0.6822 Content-type: text/plain; charset=iso-8859-1 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m15FCYnY006500 -----Original Message----- From: Anik Pal [mailto:anik AT vadodara DOT oilfield DOT slb DOT com] Sent: Tuesday, February 05, 2008 8:17 PM To: 'cygwin AT cygwin DOT com' Subject: RE: RE: undefined reference to `_msgDebug' in GCC     -----Original Message----- From: Anik Pal [mailto:anik AT vadodara DOT oilfield DOT slb DOT com] Sent: Tuesday, February 05, 2008 8:17 PM To: 'Phil DOT Betts AT ascribe DOT com' Subject: RE: RE: undefined reference to `_msgDebug' in GCC   Phil, Thanks for the info you provided. I’m not conversant with GCC.   I remove the path for regular library like libm.a, and all the paths specified in posix , now my linker option is as follows   -L/cygdrive/f/geolog6.6.1/lib -lcgg -llicence -llogs_dll -lPGILc_dll -lPGILcTool_dll -lcgs  -lgeolog6 -L/cygdrive/D/cygwin/lib/mingw -lmsvcrt -Bstatic -lm But I’m not sure how to remove the dependency on libmsvcrt.a (that comes with mingw lib in cygwin). What is the equivalent lib in cygwin/lib? Moreover I followed the solution stated in the following url to get rid of linking “undefined reference symbol __chkstk” http://eegeerg.blogspot.com/2008_01_01_archive.html#4158852069709002699 which actually states to copy chkstk.OBJ from MSVC/lib and rename to chkstk.o and link with this. Now linking error goes but when try to execute this exe, it doesn’t gives any error message but terminate unexpectedly. Regards Anik Pal India From: "Phil Betts" • To: • Date: Mon, 4 Feb 2008 15:41:43 -0000 • Subject: RE: undefined reference to `_msgDebug' in GCC Anik Pal wrote on Saturday, February 02, 2008 9:05 AM::   > I am trying to using a library in my code whose default compiler is > MSVCRT. When I try to compile that code in cygwin GCC environment I > get the following errors > > F:/geolog6.6.1/lib/libgeolog6.a(fileprintf.o):C:/development/ptc:(.text+ 0x9) >> undefined reference to `__chkstk' [snip] >> more undefined references to `_msgDebug' follow > > Can anyone tell me which cygwin-mingw library to be added to get rid > of this linking error? > > My make file linking option I'm providing as follows > > -LF:/geolog6.6.1/lib -lcgg -lgeolog6  -llicence -llogs_dll -lPGILc_dll > -lPGILcTool_dll -lcgs -llmgr9a -LD:/cygwin/lib -lcygwin > -LD:/cygwin/lib/mingw -lmsvcrt -Bstatic -LD:/cygwin/lib -lm >   First, don't use windows pathnames.  Cygwin is a POSIX environment, so use POSIX pathnames (I.e. "/cygdrive/f/" instead of "F:/")   Second, you're linking with cygwin AND msvcrt and potentially also mixing cygwin and mingw libraries.  Don't do that. The cygwin, msvcrt and mingw are fundamentally incompatible.  [Although it is possible under very specific circumstances to mix cygwin and msvcrt, it requires knowledge of the internals of both libraries, and if you had that knowledge, you wouldn't have posted your question, so the advice stands]   Make your mind up whether you want to write a POSIX program or a Windows program and stick to your decision.   Third, let the compiler choose the C runtime library.  You don't specify -lcygwin, nor the path to the standard library locations, so the only -L you need is "-L/cygdrive/f/geolog6.6.1/lib"   Fourth, libm is integral to cygwin1.dll, so you don't need -lm. The math library supplied with cygwin is only a stub to support makefiles such as yours that assume it's necessary.     Anik Pal Schlumberger, Vadodara, India   -- 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/