Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to compile a program with gnome-libs, that uses True and False, in one of the arguments. But what header file defines them?

I'm getting the following error:

guignome/guignome.c: In function ‘gui_MenuBarEntryShown’:
guignome/guignome.c:1060: error: ‘False’ undeclared (first use in this function)
[...]
guignome/guignome.c: In function ‘creategw’:
guignome/guignome.c:1309: error: ‘True’ undeclared (first use in this function)
guignome/guignome.c:1319: error: ‘False’ undeclared (first use in this function)

This is one portion of code where this error occurs:

    if (optvaltext!=NULL) {
      if (strcmp(optvaltext,wme->menuentry->optvalue)) {
        gtk_menu_item_configure(GTK_MENU_ITEM(wme->menuentrywidget),ElvFalse,False);
      } else {
        gtk_menu_item_configure(GTK_MENU_ITEM(wme->menuentrywidget),ElvTrue,False);
      };

    }; /* optvaltext!=NULL */

The file only includes gnome.h and glade.h:

#include <gnome.h>
#include <glade/glade.h>

...well?

share|improve this question
    
This almost certainly belongs on SO –  Michael Mrozek Oct 3 '10 at 9:31

1 Answer 1

up vote 2 down vote accepted

If you really meant TRUE and FALSE then /usr/include/glib-2.0/glib/gmacros.h has

#ifndef FALSE
#define FALSE   (0)
#endif

#ifndef TRUE
#define TRUE    (!FALSE)
#endif

If you meant something else, you'll need to specify what you mean by gnome-libs more precisely.

added a pretty reasonable guess

The macros you are lacking are not defined within GTK anything, and the Elv* booleans appear to be an enumerated type in the Elvis Text Editor:

enum {ElvFalse, ElvTrue} ELVBOOL;

I suspect this code was borrowed from some other codebase and lost its headers. Unsurprisingly, this makes ElvFalse equivalent to 0 and ElvTrue equal to 1 (at least in the Southern Hemisphere, I hear things are backwards up North).

Given the prototype:

void gtk_menu_item_configure(GtkMenuItem *menu_item,
         gint show_toggle_indicator,
         gint show_submenu_indicator);

the values 0 and 1 seem like pretty good guesses as to the value of the constants.

added in response to comment

From elvis-2.2_0/doc/bugs.txt:

/ Elvis' BOOLEAN and data type may clash with a standard one. Change its name, and the names of the True and False values.

Where the / is the author's flag "that I believe it has been solved." Which is peculiar when there appears

... ElvFalse,False)

in the code. But more troublesome still is in guignome/README.gnome (dated October 2003):

The Gnome/GTK+ GUI extension to Elvis is being written by David Alan Gilbert (elvis@treblig.org). It is very much in it's development stages!

I cannot build Elvis 2.2 on Unbuntu Maverick for different defects than you report (in guix11) and the latest Debian/Ubuntu repositories carry no Gnome version of elvis only X11. As the main Elvis page was last updated two years ago, I doubt the Gnome version ever worked or works with modern Gnome.

That said, there's no harm in trying

#define False (0)
#define True (!False)

but I'm not sure that will get you far.

share|improve this answer
    
OK, i clarified my question. –  polemon Oct 2 '10 at 16:39
    
Yeah, it's Elvis I'm trying to compile, but it's not ElvFalse and ElvTrue that's causing the problems, it's False and True. Couldn't I simply reassign the values in one of the headers? –  polemon Oct 3 '10 at 3:16
    
Great! that solved the issue, and I believe I'm only a few steps away from finishing the compile. guignome/guignome.o: In function 'gui_KeyPress': guignome.c:(.text+0x2ec3): undefined reference to 'elvprint'. I greped the whole code base for elvprint and there is no definition for it. Any ideas? –  polemon Oct 3 '10 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.