LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2005, 03:41 PM   #1
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Rep: Reputation: 15
Angry first gui program won't compile with g++


hey all, i just recently finished a class on c++ programming so I have all the basics down, and I wanted to take it to the next level w/ gui programming. Currently I am running gnome w/ ubuntu hoary...I wrote my first sample program off the gtkmm website, but it gives me this when i compile w/ g++:

bigcx2@zero ~/c++ $ g++ gtk.cpp -o gtk
In file included from gtk.cpp:1:
/usr/include/gtk--/main.h:27:25: gtk/gtkmain.h: No such file or directory
In file included from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gtk--/base.h:27:25: gtk--config.h: No such file or directory
In file included from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--.h:27:21: gdk/gdk.h: No such file or directory
In file included from /usr/include/gdk--.h:28,
from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--/types.h:26:21: gdk/gdk.h: No such file or directory
/usr/include/gdk--/types.h:27:25: gdk--config.h: No such file or directory
/usr/include/gdk--/types.h:38:29: gtk/gtkfeatures.h: No such file or directory
In file included from /usr/include/gdk--.h:28,
from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--/types.h:77: error: syntax error before `;' token
/usr/include/gdk--/types.h:342: error: `GdkColorContextDither' was not declared
in this scope
/usr/include/gdk--/types.h:342: error: template argument 1 is invalid
/usr/include/gdk--/types.h:342: error: invalid base-class specification
/usr/include/gdk--/types.h:343: error: `GdkColorContext' was not declared in
this scope
/usr/include/gdk--/types.h:343: error: template argument 1 is invalid
/usr/include/gdk--/types.h:343: error: invalid base-class specification
/usr/include/gdk--/types.h:344: error: `GdkGCValues' was not declared in this
scope
/usr/include/gdk--/types.h:344: error: template argument 1 is invalid
/usr/include/gdk--/types.h:344: error: invalid base-class specification
/usr/include/gdk--/types.h:358: error: `GdkWindowAttr' was not declared in this
scope
/usr/include/gdk--/types.h:358: error: template argument 1 is invalid
/usr/include/gdk--/types.h:358: error: invalid base-class specification
/usr/include/gdk--/types.h:359: error: `GdkDeviceKey' was not declared in this
scope
/usr/include/gdk--/types.h:359: error: template argument 1 is invalid
/usr/include/gdk--/types.h:359: error: invalid base-class specification
/usr/include/gdk--/types.h:360: error: `GdkDeviceInfo' was not declared in this
scope
/usr/include/gdk--/types.h:360: error: template argument 1 is invalid
/usr/include/gdk--/types.h:360: error: invalid base-class specification
/usr/include/gdk--/types.h:361: error: `GdkTimeCoord' was not declared in this
scope
/usr/include/gdk--/types.h:361: error: template argument 1 is invalid
/usr/include/gdk--/types.h:361: error: invalid base-class specification
/usr/include/gdk--/types.h:362: error: `GdkRegion' was not declared in this
scope
/usr/include/gdk--/types.h:362: error: template argument 1 is invalid
/usr/include/gdk--/types.h:362: error: invalid base-class specification
In file included from /usr/include/gdk--/types.h:365,
from /usr/include/gdk--.h:28,
from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--/color.h:32:21: gdk/gdk.h: No such file or directory
In file included from /usr/include/gdk--/types.h:365,
from /usr/include/gdk--.h:28,
from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--/color.h:46: error: parse error before `{' token
/usr/include/gdk--/color.h:52: error: syntax error before `*' token
/usr/include/gdk--/color.h:56: error: parse error before `const'
/usr/include/gdk--/color.h:57: error: parse error before `const'
/usr/include/gdk--/color.h:58: error: parse error before `const'
/usr/include/gdk--/color.h:59: error: parse error before `const'
/usr/include/gdk--/color.h:60: error: destructors must be member functions
/usr/include/gdk--/color.h:62: error: syntax error before `*' token
/usr/include/gdk--/color.h:63: error: syntax error before `*' token
/usr/include/gdk--/color.h:65: error: parse error before `&' token
/usr/include/gdk--/color.h:66: error: `bool operator==(...)' must have an
argument of class or enumerated type
/usr/include/gdk--/color.h:66: error: `bool operator==(...)' must take exactly
two arguments
/usr/include/gdk--/color.h: In function `bool operator==(...)':
/usr/include/gdk--/color.h:67: error: `color' undeclared (first use this
function)
/usr/include/gdk--/color.h:67: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/usr/include/gdk--/color.h:67: error: `equal' undeclared (first use this
function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:70: error: parse error before `&' token
/usr/include/gdk--/color.h:72: error: `gushort' was not declared in this scope
/usr/include/gdk--/color.h:72: error: parse error before `)' token
/usr/include/gdk--/color.h: In function `void set_grey(...)':
/usr/include/gdk--/color.h:74: error: `red' undeclared (first use this
function)
/usr/include/gdk--/color.h:74: error: `green' undeclared (first use this
function)
/usr/include/gdk--/color.h:74: error: `blue' undeclared (first use this
function)
/usr/include/gdk--/color.h:74: error: `g' undeclared (first use this function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:77: error: parse error before `)' token
/usr/include/gdk--/color.h: In function `void set_grey_p(...)':
/usr/include/gdk--/color.h:79: error: `gushort' undeclared (first use this
function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:82: error: `gushort' was not declared in this scope
/usr/include/gdk--/color.h:82: error: parse error before `,' token
/usr/include/gdk--/color.h: In function `void set_rgb(...)':
/usr/include/gdk--/color.h:84: error: `red_' undeclared (first use this
function)
/usr/include/gdk--/color.h:85: error: `green_' undeclared (first use this
function)
/usr/include/gdk--/color.h:86: error: `blue_' undeclared (first use this
function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:89: error: parse error before `,' token
/usr/include/gdk--/color.h:96: error: `gdouble' was not declared in this scope
/usr/include/gdk--/color.h:96: error: parse error before `,' token
/usr/include/gdk--/color.h:97: error: `gdouble' was not declared in this scope
/usr/include/gdk--/color.h:97: error: parse error before `,' token
/usr/include/gdk--/color.h:99: error: parse error before `::' token
/usr/include/gdk--/color.h:100: error: parse error before `::' token
/usr/include/gdk--/color.h:103: error: parse error before `)' token
/usr/include/gdk--/color.h:104: error: parse error before `)' token
/usr/include/gdk--/color.h:105: error: parse error before `)' token
/usr/include/gdk--/color.h:107: error: `gushort' was not declared in this scope
/usr/include/gdk--/color.h:107: error: parse error before `)' token
/usr/include/gdk--/color.h: In function `void set_red(...)':
/usr/include/gdk--/color.h:107: error: `r' undeclared (first use this function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:108: error: parse error before `)' token
/usr/include/gdk--/color.h:109: error: `gushort' was not declared in this scope
/usr/include/gdk--/color.h:109: error: parse error before `)' token
/usr/include/gdk--/color.h: In function `void set_blue(...)':
/usr/include/gdk--/color.h:109: error: `b' undeclared (first use this function)
/usr/include/gdk--/color.h: At global scope:
/usr/include/gdk--/color.h:111: error: parse error before `)' token
/usr/include/gdk--/color.h:113: error: parse error before `)' token
/usr/include/gdk--/color.h:114: error: parse error before `)' token
/usr/include/gdk--/color.h:115: error: parse error before `)' token
/usr/include/gdk--/color.h:119: error: parse error before `&' token
/usr/include/gdk--/color.h:120: error: parse error before `&' token
In file included from /usr/include/gdk--.h:28,
from /usr/include/gtk--/base.h:33,
from /usr/include/gtk--/main.h:28,
from gtk.cpp:1:
/usr/include/gdk--/types.h:367: error: `GdkPoint' was not declared in this
scope
/usr/include/gdk--/types.h:368: error: template argument 1 is invalid
/usr/include/gdk--/types.h:368: error: invalid base-class specification
/usr/include/gdk--/types.h:371: error: parse error before `(' token
/usr/include/gdk--/types.h:371: error: syntax error before `(' token
/usr/include/gdk--/types.h:376: error: ISO C++ forbids defining types within
return type
/usr/include/gdk--/types.h:376: error: semicolon missing after declaration of `
class Gdk_Point'
/usr/include/gdk--/types.h: In function `int Gdk_Point()':
/usr/include/gdk--/types.h:376: error: only constructors take base initializers
/usr/include/gdk--/types.h:376: error: `GdkPoint' undeclared (first use this
function)
/usr/include/gdk--/types.h:376: error: template argument 1 is invalid
/usr/include/gdk--/types.h:376: confused by earlier errors, bailing out

I have no idea what do with this...any suggestions?

Also, I recently got Anjuta IDE and I never got into using before but today when I started it, the splash screen comes up and then hangs.

Any help would be greatly appreciated. I hate not being able to figure stuff out like this myself but it's just driving me nuts.

 
Old 03-02-2005, 03:47 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
sounds like you don't have gtk1 installed, or at least any matching -dev .deb file. no idea if there is one or not to be honest though. if everything seems to be installed then check if any relevant include directory, e.g. /usr/include, /usr/local/include... does contain gtk/gtk.h and such.
 
Old 03-02-2005, 03:55 PM   #3
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
i know i have the right header files installed but they are not in /usr/include/c++/ they are in /usr/include/gtkmm-2.0/gtkmm/.
How do I get g++ to recognize these files?
 
Old 03-02-2005, 04:06 PM   #4
linuxzealot
Member
 
Registered: Feb 2005
Distribution: Gentoo
Posts: 57

Rep: Reputation: 15
Just copy over the header files in /usr/include/gtkmm-2.0/gtkmm/
to the /usr/include/c++/ directory. Should work if /usr/include/c++/ is where g++ is looking for the header files
 
Old 03-02-2005, 04:11 PM   #5
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
ok wasn't sure if that would mess anything up....be back in a couple
 
Old 03-02-2005, 04:14 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Bad practice to copy stuff around ...

Use
Code:
~/c++ $ g++ gtk.cpp -o gtk `pkg-config --cflags gtk+`
instead.


Cheers,
Tink
 
Old 03-02-2005, 04:26 PM   #7
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
nope, no luck
 
Old 03-02-2005, 04:27 PM   #8
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
oh the command g++ gtk.cpp -o gtk `pkg-config --cflags gtk+`gives me about 300 more errors than the first...
 
Old 03-02-2005, 04:31 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
pkg-config --cflags gtk+

If you run that on the command-line, what do you get?

And is it still complaing about the missing header?


Cheers,
Tink
 
Old 03-02-2005, 04:39 PM   #10
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
bigcx2@zero ~/c++ $ pkg-config --cflags gtk+
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include
 
Old 03-02-2005, 04:46 PM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
remember that you are dealing directly with gtkmm, not gtk+. i assume you'd want cflags for both, but i'm not sure. either way, gtkmm and gtk+ are going to use gtk-config and gtkmm-config, only gtk2 uses the pkg-config system.
 
Old 03-02-2005, 04:49 PM   #12
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
bigcx2@zero ~/c++ $ pkg-config --cflags gtkmm
Package gtkmm was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm' found
bigcx2@zero ~/c++ $ locate gtkmm.pc
bigcx2@zero ~/c++ $
 
Old 03-02-2005, 04:50 PM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
exactly my point above... "gtkmm-config --cflags --libs" i assume
 
Old 03-02-2005, 04:54 PM   #14
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
ooh! looks like we're getting somewhere!

bigcx2@zero ~/c++ $ g++ gtk.cpp -o gtk `gtkmm-config --cflags --libs`
gtk.cpp: In function `int main(int, char**)':
gtk.cpp:13: error: parse error before `return'


here check out the code:

bigcx2@zero ~/c++ $ g++ gtk.cpp -o gtk `gtkmm-config --cflags --libs`
gtk.cpp: In function `int main(int, char**)':
gtk.cpp:13: error: parse error before `return'
 
Old 03-02-2005, 04:55 PM   #15
BigCdaAnswer3
Member
 
Registered: Apr 2004
Distribution: Ubuntu Hoary
Posts: 56

Original Poster
Rep: Reputation: 15
woops hold on
 
  


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
MPlayer wont compile with gui on FC3 x86_64 a1ex_007 Fedora 1 06-22-2005 08:39 AM
gui for a fortran program kooshball Programming 2 06-06-2005 08:37 AM
I need a C++ program with GUI. amer_58 Linux - Newbie 5 03-11-2005 01:32 PM
how to compile mplayer with GUI on SuSE 9.2? mking007 SUSE / openSUSE 1 11-16-2004 04:22 AM
Run a program from the GUI k.03 Linux - Newbie 3 04-09-2003 08:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 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