You are not logged in.
Pages: 1
I'm programming a simple C app, and I am trying to get the function gtk_window_set_size() to work, this is what I have:
gtk_window_set_size((GtkWindow*)main_win, 240,250);
When i compile I get this error:
undefined reference to `gtk_window_set_size'
collect2: ld returned 1 exit status
make: *** Error 1
Is gtk_window_set_size() the right command to be using?
Offline
This only sets the default size within the init_main code portion of your GTK window, it doesn't allow you to change the size this way by a button or menu item, ect.
Offline
When i compile I get this error:
undefined reference to `gtk_window_set_size' collect2: ld returned 1 exit status make: *** Error 1
How do you compile it? Post the command line. It looks like you forgot to link to the gtk library.
Offline
twiistedkaos wrote:When i compile I get this error:
undefined reference to `gtk_window_set_size' collect2: ld returned 1 exit status make: *** Error 1
How do you compile it? Post the command line. It looks like you forgot to link to the gtk library.
With a makefile, but it is linking the gtk2.0 libs
VERSION = 0.1
CC = gcc
INSTALL=install
STRIP=strip
CFLAGS = -DVERSION="$(VERSION)" `pkg-config --cflags gtk+-2.0` `pkg-config --cflags xmms2-client`
LDFLAGS = `pkg-config --libs gtk+-2.0` `pkg-config --libs xmms2-client` `pkg-config --libs xmms2-client-glib`
OBJS = sXMMS2.o
BIN = sXMMS2
all: $(BIN)
$(BIN): $(OBJS)
$(CC) $(LDFLAGS) -o $(BIN) $(OBJS)
file.o: file.c
$(CC) -c $(CFLAGS) -o sXMMS2.o sXMMS2.c
Offline
use gtk_window_resize
Offline
I love this factoid from the bot in ##C++:
undefined reference is a linker error. It's not a compile error. Adding #includes doesn't help. You did not define the thing in the error message, or you forgot to link the file that defines it, or you forgot to link to the library that defines it. Check which one. (Note that on some compilers it's called unresolved external symbol or similar)
There is your error.
Offline
I love this factoid from the bot in ##C++:
undefined reference is a linker error. It's not a compile error. Adding #includes doesn't help. You did not define the thing in the error message, or you forgot to link the file that defines it, or you forgot to link to the library that defines it. Check which one. (Note that on some compilers it's called unresolved external symbol or similar)
There is your error.
Thanks, but gtk_window_resize works fine
Offline
Another question, for selecting and deselecting items in a treeview, I am using this to select a current song in my playlist:
path = gtk_tree_path_new_from_indices( playlist_pos, -1 );
sel = gtk_tree_view_get_selection( (GtkTreeView*)list_view );
gtk_tree_selection_select_path( sel, path );
gtk_tree_path_free( path );
Problem is, it doesn't deselect the last selection in the playlist, so everytime song is changed it select the next song leaving the provious selected also.
Offline
seems to me like you'll either want to set the selection mode to GTK_SELECTION_SINGLE, or unselect all the previously selected items before you make that selection in your program
Offline
seems to me like you'll either want to set the selection mode to GTK_SELECTION_SINGLE, or unselect all the previously selected items before you make that selection in your program
Thanks, that worked
Offline
Pages: 1