Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use gettext in vala?

Tags:

gettext

vala

When I try to use gettext in vala I get not errors or warnings from vala but I get the following error from the c compiler:

/usr/include/glib-2.0/glib/gi18n-lib.h:29:2: error: #error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h?

How can I fix this?

like image 957
david4dev Avatar asked Aug 28 '11 15:08

david4dev


1 Answers

To solve this problem I had to both add -X -DGETTEXT_PACKAGE="..." to the valac command and add const string GETTEXT_PACKAGE = "..."; to the top of my source file.

If I don't add that to the top of my source file, I get lots of undeclared (first use in this function) errors from the C compiler for some reason.

I do, however, get a warning from the C compiler for redefining GETTEXT_PACKAGE.

like image 86
david4dev Avatar answered Sep 27 '22 23:09

david4dev