GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error compiling book example

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> General GTK+ Discussion
Author Message
mattsites



Joined: 03 May 2007
Posts: 2

PostPosted: Thu May 03, 2007 1:03 pm    Post subject: Error compiling book example Reply with quote

I'm new to GTK, C and just started reading Andrew Krause's new book, and I tried to compile the first helloworld program. I'm using Ubuntu Feisty Fawn and have installed all of the libraries that Andrew talks about. This is the error I'm getting...

gcc: pkg-config --cflags gtk+-2.0: No such file or directory
gcc: pkg-config --libs gtk+-2.0: No such file or directory
helloworld.c:1:21: error: gtk/gtk.h: No such file or directory
helloworld.c: In function ‘main’:
helloworld.c:4: error: ‘GtkWidget’ undeclared (first use in this function)
helloworld.c:4: error: (Each undeclared identifier is reported only once
helloworld.c:4: error: for each function it appears in.)
helloworld.c:4: error: ‘window’ undeclared (first use in this function)
helloworld.c:6: warning: implicit declaration of function ‘gtk_inut’
helloworld.c:8: warning: implicit declaration of function ‘gtk_window_new’
helloworld.c:8: error: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this function)
helloworld.c:9: warning: implicit declaration of function ‘gtk_window_set_title’
helloworld.c:9: warning: implicit declaration of function ‘GTK_WINDOW’
helloworld.c:10: warning: implicit declaration of function ‘gtk_widget_show’
helloworld.c:12: warning: implicit declaration of function ‘gtk_main’
helloworld.c:13: error: ‘return0’ undeclared (first use in this function)
helloworld.c:15: warning: control reaches end of non-void function

I'm using the sample code provided with the book.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 428
Location: Portland, OR USA

PostPosted: Thu May 03, 2007 1:34 pm    Post subject: Reply with quote

If I had to guess, I would say you are missing the back ticks (usually the key which also has the tilde ~ character) around the pkg-config commands. The backtick operator tells the shell to execute the pkg-config command and put it's output in that place. It is NOT a single quote.

I can't post it right here because the backtick poses a security risk and the server won't allow it, but, make sure you type it EXACTLY as it appears in the book, with the exception of the "\" character which is only there to show you that he's breaking the line in the book. You can type it all out in one line.
Back to top
mattsites



Joined: 03 May 2007
Posts: 2

PostPosted: Thu May 03, 2007 2:25 pm    Post subject: Reply with quote

Thanks, you were right. I didn't type in the ticks, I used single quotes. Now its working!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> General GTK+ Discussion All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP