Author Topic: C::B with GTK+ 2.12  (Read 5932 times)

kronos

  • Guest
C::B with GTK+ 2.12
« on: November 29, 2008, 05:00:26 am »
Hello everybody.

My name is moisés and my problem is the next.

I am programing with GTK  2.12 and vs.net 2003, but now I need use the solarsocket library but  I was unable to compile any example con vs.net and in the forum of solarsocket I do not have an answer, but at the homepage of solarsockets said that his library is compatible with C:: B and mingw 3.4.x,

So I am using C:: B v1.0rc2 because with this compiler I can compiler examples of solarSockets, and now I am trying to compile a example of GTK, and use this page to configure C::B

http://shankao.mitreum.net/index.php?section=blog&page=viewpost&id=4

I set GTK_HOME=C:\GTK in  "Settings > Compiler > Custom Variables"
I add all directories of GTK in Settings > Compiler > Directories > Compiler

$(GTK_HOME)\include
$(GTK_HOME)\include\gtk-2.0
$(GTK_HOME)\include\glib-2.0
$(GTK_HOME)\include\pango-1.0
$(GTK_HOME)\include\atk-1.0
$(GTK_HOME)\include\gtkglext-1.0
$(GTK_HOME)\lib\gtk-2.0\include
$(GTK_HOME)\lib\glib-2.0\include
$(GTK_HOME)\lib\gtkglext-1.0\include
$(GTK_HOME)\include\libglade-2.0
$(GTK_HOME)\include\libxml2
$(GTK_HOME)\include\freetype2
$(GTK_HOME)\include\sigc  -2.0
$(GTK_HOME)\lib\sigc  -2.0\include
$(GTK_HOME)\include\cairo
$(GTK_HOME)\lib\gtkmm-2.4\include
$(GTK_HOME)\include\gtk-2.0\gdk
etc..

I add directorie of librarie “$(GTK_HOME)\lib“ in Settings > Compiler > Directories > Linker

and set -mms-bitfields in Project > Build options > Compiler > Other options

But when I compile the next simple example of gtk



#include <gtk/gtk.h>

int main( int   argc,
        char *argv[] )
{
  GtkWidget *window;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show  (window);

  gtk_main ();

  return 0;
}



C::B get me the next error:

ld.exe  cannot find –lglib

I try to find some answers in the forum but did not find anything about this error

can someone help me?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9706
Re: C::B with GTK+ 2.12
« Reply #1 on: November 29, 2008, 11:11:25 am »
I add all directories of GTK in Settings > Compiler > Directories > Compiler

can someone help me?
You not only need to setup the compiler include path's but also the linker include path's so that the linker can find the libraries. You are mixing all of these path together and provide them just to the compiler. Read the GTK development guide on how to setup a project (in general) properly. Meaning: What need to be setup for the compiler and what for the linker. I can't tell as I am not using GTK. But I can tell you that you did a wrong project setup.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: C::B with GTK+ 2.12
« Reply #2 on: November 29, 2008, 12:04:09 pm »
So I am using C:: B v1.0rc2 because with this compiler

As first C::B is not a compiler "just" an IDE,
as second do you really use 1.0rc2 ? It's about 3 years old. I advise you to use either the 8.02 release or an actual nightly build