bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext-0.14.1 -- problems compiling C++ programs


From: Bruno Haible
Subject: Re: gettext-0.14.1 -- problems compiling C++ programs
Date: Tue, 23 Nov 2004 15:56:22 +0100
User-agent: KMail/1.5

Peter Breitenlohner wrote:
> in several packages using this or another recent gettext version
> I had to correct the gettext.h included in that package as per the
> attached patch. The problem occurs when compiling C++ programs with
> "configure --disable-nls". The comments in the patch ought to be
> self-explanatory.

Hi,

To let me reproduce the problem, you could have said that
  - you are using g++ 3.4.x,
  - a simple test program is
============ foo.cc ============
#include "gettext.h"
#include <iostream>
================================

Anyway, thanks for the report. I'll be using the following fix in GNU gettext.

Bruno


*** gettext.h   13 Feb 2003 21:21:41 -0000      1.1
--- gettext.h   23 Nov 2004 14:52:50 -0000
***************
*** 1,5 ****
  /* Convenience header for conditional use of GNU <libintl.h>.
!    Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify it
     under the terms of the GNU Library General Public License as published
--- 1,5 ----
  /* Convenience header for conditional use of GNU <libintl.h>.
!    Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify it
     under the terms of the GNU Library General Public License as published
***************
*** 37,42 ****
--- 37,52 ----
  # include <locale.h>
  #endif
  
+ /* Many header files from the libstdc++ coming with g++ 3.4 or newer include
+    <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
+    it now, to make later inclusions of <libintl.h> a NOP.  */
+ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
+ # include <cstdlib>
+ # if _GLIBCXX_HAVE_LIBINTL_H
+ #  include <libintl.h>
+ # endif
+ #endif
+ 
  /* Disabled NLS.
     The casts to 'const char *' serve the purpose of producing warnings
     for invalid uses of the value returned from these functions.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]