Re: compiling gtkmm hello world example



On Sun, Mar 30, 2008 at 7:24 AM, bigblop <fedevaps yahoo dk> wrote:
>
>  I am trying to compile the below example on Ubuntu 7.10:
>
>  http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-helloworld.html
>
>  I use my own makefile:
>
>  INC=/usr/include/gtkmm-2.4/gtkmm/
>  all: main
>
>  main: helloworld.h helloworld.cpp main.cpp
>         gcc main.cpp $(INC) -o main
>
>  But I get the error:
>  gcc main.cpp /usr/include/gtkmm-2.4/gtkmm/ -o main
>  main.cpp:1:24: error: gtkmm/main.h: No such file or directory
>
>  even though I have included the path in the include option. What am I doing
>  wrong?

You should use pkg-config to set the include dirs, instead of doing it
by hand (for example, you don't currently have the include dirs for
gdkmm, pangomm, cairomm, glibmm, etc, etc).  In addition, you're not
specifying which libraries to link against.  Thirdly, you're using gcc
but you should be using g++ since you're attempting to compile C++.
So your command should look something like:

g++ main.cpp `pkg-config --libs --cflags gtkmm-2.4` -o main

-- 
jonner


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]