delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/15/13:47:47

X-Spam-Check-By: sourceware.org
Date: Fri, 15 Jun 2007 13:47:26 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Alexey Lyubimov <alexeipobox AT yahoo DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: 1.5.24-2 (locale.h): Compilation ERRORs ?!
In-Reply-To: <109171.80259.qm@web33207.mail.mud.yahoo.com>
Message-ID: <Pine.GSO.4.63.0706151333240.23164@access1.cims.nyu.edu>
References: <109171 DOT 80259 DOT qm AT web33207 DOT mail DOT mud DOT yahoo DOT com>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Fri, 15 Jun 2007, Alexey Lyubimov wrote:

> Hello!
> When I try to compile very simple example from
> gettext's tutorial - I get compilation errors using
> gcc or g++.
>
> Here is the source code:
> -----------------------------
> main.c or main.cc
>
> #include <libintl.h>
> #include <locale.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> #define _(aString) gettext(aString)
>
> int
> main(void)
> {
>   setlocale(LC_ALL, "");
>   bindtextdomain("gt", "/usr/share/locale");
>   textdomain("gt");
>   printf(_("Hello, world!\n"));
>   exit(0);
> }
> ----------------------------------
>
> 1) I CAN NOT build the test program with MinGW (-mno-cygwin):
>
> $ gcc -o gt -mno-cygwin -g main.c
>
> main.c:3:21: libintl.h: No such file or directory
> [snip]

Not surpising, as there is no MinGW gettext visible to gcc on your system.

> 2) I CAN NOT build the test program as C-program (with gcc):

You must mean a *Cygwin* C program.

> $ gcc -o gt -g main.c
> In file included from /usr/include/libintl.h:22,
>                  from main.c:3:
> /usr/include/locale.h:26: error: syntax error before
> "struct"
>
> I think it's because GCC doesn't understand
> _BEGIN_STD_C, _END_STD_C macros used inside "locale.h"

Hmm, those ought to have been defined in _ansi.h.  Try running "gcc -E
main.c" and see what exactly is produced by the macro expansion.

> 3) I CAN NOT build the test program as C++-program
> (with g++):
>
> g++ -o gt -g main.cc
> In file included from /usr/include/sys/config.h:167,
>                  from /usr/include/_ansi.h:16,
>                  from /usr/include/locale.h:10,
>                  from /usr/include/libintl.h:22,
>                  from main.cc:3:
> /usr/include/cygwin/config.h:18: error: expected
> constructor, destructor, or type conversion before "extern"
> /usr/include/cygwin/config.h:18: error: expected `,'
> or `;' before "extern"
>
> What is wrong? What is the workaround?

Not sure.  Builds fine on my system, with both gcc and g++, with "main.c
or main.cc" commented out...

However, a WAG: when you say

> Here is the source code:
> -----------------------------
> main.c or main.cc
>
> #include <libintl.h>

Do you mean that the first line of your program is actually "main.c or
main.cc"?  If not, what is the first line?  I get a similar message if I
put something nonsensical there, like "class".
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

--
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/

- Raw text -


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