GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Jul 25, 2014 12:59 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Error compiling book example
PostPosted: Thu May 03, 2007 1:03 pm 
Offline

Joined: Thu May 03, 2007 12:53 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 1:34 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 2:25 pm 
Offline

Joined: Thu May 03, 2007 12:53 pm
Posts: 2
Thanks, you were right. I didn't type in the ticks, I used single quotes. Now its working!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group