Find the answer to your Linux question:
Results 1 to 2 of 2
hi I am trying entry.c program given in tutorial ( Linux Headquarters: GtkEntry - Single Line Text Entry Widget ) it is working properly using gcc. But If i try ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46

    problem with gtk_table_attach function using g++

    hi

    I am trying entry.c program given in tutorial (Linux Headquarters: GtkEntry - Single Line Text Entry Widget)
    it is working properly using gcc.

    But If i try it with g++.Then it is giving me error:

    [vineeta@vineeta sample]$ gcc entry1.cpp -o entry1 `pkg-config --cflags --libs gtk+-2.0`
    entry1.cpp: In function `int main(int, char**)':
    entry1.cpp:56: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:56: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:57: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:57: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:58: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:58: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:59: invalid conversion from `int' to `GtkAttachOptions'
    entry1.cpp:59: invalid conversion from `int' to `GtkAttachOptions'

    how to resolve this error?

    what is purpose of ORing in argument like this GTK_EXPAND | GTK_SHRINK | GTK_FILL??

    Regards
    vineeta

  2. #2
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    For some reason it's not working , i don't know why exactly but you can tell your compiler that this value is (GtkAttachOptions)

    so instead of doing like this :

    gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);

    do like this

    gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_SHRINK | GTK_FILL),(GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);

    I didn't understand your second question !

    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...