Author Topic: Problem compiling GTK with Linux  (Read 4206 times)

elwario91

  • Guest
Problem compiling GTK with Linux
« on: February 03, 2007, 08:43:18 pm »
Hello,
I'm using Linux Ubuntu Edgy
I tried compiling a GTK source file but first he didn't found the header,
I added the directories in the compiler options -> directories
Now he seems to find it and compile a bit better but but :(

I have this output :

Code
/home/warren/Projects/eeee/main.cpp:10: référence indéfinie vers « gtk_init »
/home/warren/Projects/eeee/main.cpp:13: référence indéfinie vers « gtk_window_new »
/home/warren/Projects/eeee/main.cpp:14: référence indéfinie vers « g_type_check_instance_cast »
/home/warren/Projects/eeee/main.cpp:14: référence indéfinie vers « gtk_main_quit »
/home/warren/Projects/eeee/main.cpp:14: référence indéfinie vers « g_signal_connect_data »
/home/warren/Projects/eeee/main.cpp:17: référence indéfinie vers « gtk_widget_show »
/home/warren/Projects/eeee/main.cpp:18: référence indéfinie vers « gtk_main »
/home/warren/Projects/eeee/main.cpp:21: référence indéfinie vers « gtk_exit »
:: === Build finished: 8 errors, 0 warnings ===

Please help me, I'm ecomong crazy!!
Thanks

Offline momaa

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Problem compiling GTK with Linux
« Reply #1 on: February 04, 2007, 01:42:59 pm »
You have installed "libgtk2.0-dev" package in Ubuntu. Apt-get it or use Synaptic Package Manager.
Then use pkg-config to find out both --cflags and --libs path for gtk+-2.0.  Like this:

$ pkg-config --cflags gtk+-2.0
and
$ pkg-config --libs  gtk+-2.0
---

Download this example of GTK+ 2.0 project: http://www.futuredesktop.org/tmp/test3.tar.gz
( note: if you must unzip it manually, do:  tar -xvzf test3.tar.gz )

Open the project in Code::Blocks and study the settings in Project -> Build options.
* Compiler  -- Other options.
and
* Linker -- Other linker options.
-----------

This quide will tell you more.
http://www.gtk.org/tutorial/x111.html

 :D
« Last Edit: February 04, 2007, 02:05:58 pm by momaa »

Offline momaa

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Problem compiling GTK with Linux
« Reply #2 on: February 04, 2007, 01:51:02 pm »
Sorry.

I sent you a bad code.  The project options in the tar-gz ball (test3.tar.gz) are not set right.  Wait a minute till I upload an updated copy.
EDIT: OK. It's up2date now. 
« Last Edit: February 04, 2007, 02:00:12 pm by momaa »