[Anjuta-list] Re: Help compiling a GTK-- test program



> Quoting A Bouanan <<EMAIL: PROTECTED>>:
> > > c++ -g -O2 -o testaissa testaissa.o window1.o window1_glade.o
> > > testaissa.o: In function `window1 type_info function`:
> > > /home/maverick/Projects/Testaissa-0.1/src/window1.hh:481: undefined
> > > reference to `Gnome::Main::Main(int, basic_string<char,
> > I don't understand where is the problem !
> There's no linking against the gtk-- librairies, that's the reason why you've
> got undefined symbols.
>
> You should add the link flags from gtkmm-config --libs.
> 
> --
> Stef

this email has grown a bit long  - sorry :)

-----
1) I have the same problem here with a gtk-- test project from the wizard... using 0.17 on debian (unstable) with gtk-- 1.2.8 installed and functioning correctly.

I selected "C++ only" in the wizard, I have support for "C++ bindings for gtk" turned on in the compiler options, and my compiler commands show:

Compile: g++ $(anjuta.compiler.flags) -c $(current.file.name.ext) -o $(current.file.name).o `gtkmm-config --cflags --libs`
Build: g++ $(anjuta.compiler.flags) $(anjuta.linker.flags) $(current.file.name.ext) -o $(current.file.name) `gtkmm-config --cflags --libs`

This should work, I think?

However, when I compile, I see the following:

	C++ DHAVE_CONFIG_H -I. -I. -I.. `gtkmm-config --cflags` <snip other flags> -c test.cc
	C++ DHAVE_CONFIG_H -I. -I. -I.. `gtkmm-config --cflags` <snip other flags> -c window1.cc
	C++ DHAVE_CONFIG_H -I. -I. -I.. `gtkmm-config --cflags` <snip other flags> -c window1_glade.cc

and a whole load of build errors. Seems to me that anjuta is not passing the "--libs" flags to the compiler. How do I sort this?

-----------
2) When I traverse into the project src directory, and try to compile by hand with:

	g++ test.cc -o test `gtkmm-config --cflags --libs`

I get the error:

	test.cc:8: config.h: No such file or directory

The corresponding line in test.cc is:

	#include <config.h>

At this point, I should come clean and admit that I am just begining to learn how to program / debug...  I've checked /usr/include and can't find "config.h"... so I took a guess that it means the "config.h" in the project directory. I hard coded this and tried again, only to get the same errors as the previous poster:

/tmp/cchB7mva.o: In function `main':
/tmp/cchB7mva.o(.text+0x4d): undefined reference to `Gnome::Main::Main(int, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &, int, char **)'

and so on...

This lead to me wondering: where have I gone wrong in compiling by hand? Also, how come the default gtk-- project has includes for gnome--? I just want to write a gtk app, not a gnome app, as at some point, I might well port my program to windows. I think this is just possible with gtk--, but I *really* don't want to depend on any gnome-- libs... 

Many thanks to anyone who managed to read all the way down here!

Sam.





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