LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-25-2005, 11:50 PM   #1
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Rep: Reputation: 30
Can't compile sample GTK app


There seems to be something wrong with either GCC or with GTK. I recently tried to compile the sample GTK application in a programming book I got, but it will not compile. It complains about do_click being undeclared, though it should be declared in gtk.h.

I'd been able to compile GTK programs with the same function doing the exact same thing before, so I don't know what's wrong.

Here's the program.
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>

int main(int argc, char *argv[]){
GtkWidget *window, *button;

int count = 0;

gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
//gtk_container_border_width(GTK_CONTAINER(window), 5);
button = gtk_button_new_with_label("Click to increment counter");
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(do_click), &count);
gtk_container_add(GTK_CONTAINER(window), button);



gtk_widget_show(button);
gtk_widget_show(window);

gtk_main();

return 0;
}

GCC 3.3.4 GTK +- 2.0

Last edited by slackwarefan; 07-25-2005 at 11:52 PM.
 
Old 07-26-2005, 01:10 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
What is the entire error message?
 
Old 07-26-2005, 01:20 AM   #3
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
14 Error: do_click undeclared (first use in this function)
14 Error: (Each undeclared identifier is declared only
14 Error: once for each function it appears in.)
 
Old 07-26-2005, 01:32 AM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I don't find a do_click in my gtk.h and related files. Where did you find this sample?
 
Old 07-26-2005, 12:37 PM   #5
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
The book is "Linux Programming 2nd edition UNLEASHED"

I see you may be right. I just looked at the tutorial on gtk.org and they did the same program differently.

Last edited by slackwarefan; 07-26-2005 at 12:38 PM.
 
Old 07-26-2005, 07:57 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I wonder if that book may be thinking gtk-1.2? I haven't looked in those header files, just gtk2 since that is what you specified above.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Port a GTK+ app to Windows anime4christ Linux - Software 10 11-21-2005 08:28 PM
XID in Gtk APP pulsez Programming 1 07-13-2005 06:12 PM
gtk app problem emg Linux - Software 3 04-30-2005 01:22 PM
Using sample C++ code from a book...won't compile Baix Programming 4 03-05-2005 02:04 PM
Multiplatform sound library for Gtk app Komakino Programming 1 03-20-2004 06:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration