Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-25-2009, 04:19 AM   #1
Ian D
Registered: Aug 2005
Location: Solihull, UK
Distribution: Fedora 9
Posts: 127

Rep: Reputation: 15
How to compile?

I have some source code (which I have compiled before on a different machine). I have just installed Ubuntu and installed several packages - but I seem to be missing at least 1.

I have a folder containing 2 .cc files and 1 .h file

I CD to that folder and type g++ -o filename *.cc
(where filename is the name I want to call the compiled output)

I get a number of errors, but the first is that gtkmm.h cannot be found.

Which package should I install to get gtkmm.h?

Old 07-25-2009, 04:28 AM   #2
Registered: Mar 2005
Location: UK
Distribution: opensuse 12.2 x86_64
Posts: 563

Rep: Reputation: 38
On opensuse there are gtkmm2 and gtkmm2-devel packages. Probably you will need both.
Old 07-25-2009, 04:31 AM   #3
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295

I have come across the same problem with other files and dependencies, packages not installed and so on. Since you're using Ubuntu you can use the apt-file program which will list all the packages that contain the file(s) that give you the error. First you'll have to install the program using:
apt-get install apt-file
After that do an update:
apt-file update
and then you can start using it:
apt-file search gtkmm.h
which will give you the result:
libgtkmm-2.4-dev: /usr/include/gtkmm-2.4/gtkmm.h
libgtkmm-doc: /usr/share/doc/libgtkmm1.2-0c2a/FAQ/gettinggtkmm.html
So the package you need to install is libgtkmm-2.4-dev

This way you'll always have a handy tool to assist you with compilation errors.

Kind regards,

Old 07-25-2009, 04:35 AM   #4
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Ian D, you do know, also, that you have to tell the compiler to link the gtkmm libraries, right? Just running "g++ -o outfile *.cc" doesn't include the right flags to tell the compiler/linker about the gtkmm libraries. A simple command line to include the right flags can be found here, but you may want to read more detailed information (which you can probably find in the gtkmm documentation, but I don't use it myself, so I'm not sure).
Old 07-25-2009, 05:22 AM   #5
Ian D
Registered: Aug 2005
Location: Solihull, UK
Distribution: Fedora 9
Posts: 127

Original Poster
Rep: Reputation: 15
Thanks Nylex,

I had forgotten the bit about those flags.

On the other machine I have a file to remind me how to compile - but that machine won't boot (hardware problem), so I can't read my handy file.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[Compile kernel] How to compile/install the modules ? frenchn00b Linux - General 1 09-06-2009 03:18 PM
Trying to patch kernel + compile, compile is looping. kripz Linux - Kernel 1 06-16-2009 06:51 AM
CLFS 5.9 - Glibc compile: suffix of object files, cannot compile Noddegamra Linux From Scratch 3 04-27-2009 12:49 AM
how to compile software for any other Linux box which is do not have compile? hocheetiong Linux - Newbie 4 03-06-2009 04:35 PM
ntop compile/post-compile problem? tjb Linux - Software 3 12-28-2004 04:22 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:57 AM.

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