Error if gi18n-lib.h happens to come after config.h
Submitted by Christian Dywan
Link to original bug (#618931)
Description
I encounter an error if I use _() for localization. The problem depends on how Vala chooses to order #include lines in the generated C code. Apparently the order of "using" lines doesn't matter.
In file included from default/postler/postler-bureau.c:20:0:
/usr/include/glib-2.0/glib/gi18n-lib.h:29:2: Fehler: #error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h?
To elaborate, I define the symbol like this:
[CCode (cprefix = "", lower_case_prefix = "", cheader_filename = "config.h")]
namespace Config {
[CCode (cname = "GETTEXT_PACKAGE")]
public const string GETTEXT_PACKAGE;
My workaround to influence the #include order is right now this:
const string GETTEXT_PACKAGE_CONTENT = Config.GETTEXT_PACKAGE;
So the Vala compiler should actually ensure that the #includes are ordered correctly. In #vala the suggested solution was to introduce a 'crequire_symbol' so that Vala could know that it has to include config.h first.
Edited by Rico Tzschichholz