What to do if --use-header is deprecated and will be ignored

I would like to use config.h file for internationalization, since the build system itself seems to recommend it:

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

So I wrote this in my config.h:

#ifndef _CONFIG_H_
#define _CONFIG_H_
#define GETTEXT_PACKAGE "i18n_test"
#include <glib/gi18n-lib.h>
#endif /* _CONFIG_H_ */

But then I get the message in the title when I run valac. What should be the proper way to prepare for internationalization then?

You’ll probably want to define GETTEXT_PACKAGE as define since you’d have to include config.h in every source file (where you use i18n) otherwise which would be rather cumbersome.

See https://gitlab.gnome.org/Cogitri/Health/-/blob/0.91.0/src/meson.build#L74 for how to do that.

1 Like

Wow! Your health tracking app gave me lots of ideas. Thanks! :smiley:

gcc can help you there with -include config.h

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.