The first one is a x86 machine!!
I have included the gtk+ bin folder into the path variable of the system!!
Then i tested it by typing gtk-demo in the command prompt !!
I then created a new C++ project and selected MinGW GCC under Executable > Empty Project
Then i configured the eclipse as per instructions from internet
This is what i did:
I added the directories in the output of
"pkg-config --cflags gtk+-2.0"
to the Includes tab under C/C++ General >> Includes tab >> then GNU C >> Added the directories to all configurations and all languages!!
The directories are as follows :
===============================================================
C:/Program Files/gtk+_win32/include/gtk-2.0
C:/Program Files/gtk+_win32/lib/gtk-2.0/include
C:/Program Files/gtk+_win32/include/atk-1.0
C:/Program Files/gtk+_win32/include/cairo
C:/Program Files/gtk+_win32/include/gdk-pixbuf-2.0
C:/Program Files/gtk+_win32/include/pango-1.0
C:/Program Files/gtk+_win32/include/glib-2.0
C:/Program Files/gtk+_win32/lib/glib-2.0/include
C:/Program Files/gtk+_win32/include
C:/Program Files/gtk+_win32/include/freetype2
C:/Program Files/gtk+_win32/include/libpng14
===============================================================
Then i took the output of
"pkg-config --libs gtk+-2.0"
and added the following to C/C++ Build >> Settings >> Tool Settings >> MinGW C++ Linker
(Please note that this is a bug in MinGW that it does not produces the exact names of files as below rather the 'lib' is stripped to just 'l' there, please correct that in your installation )
===============================================================
libgtk-win32-2.0
libgdk-win32-2.0
libatk-1.0
libgio-2.0
libpangowin32-1.0
libgdi32 (not this one as it doesn't exist in that folder)
libpangocairo-1.0
libgdk_pixbuf-2.0
libpango-1.0
libcairo
libgobject-2.0
libgmodule-2.0
libgthread-2.0
libglib-2.0
libintl
===============================================================
and set the library search path to "C:\Program Files\gtk+_win32\lib\"
Now i also added the following to "GCC C++ Compiler" , "GCC C Compiler" and "MinGW C++ Linker" to the "Command line pattern" :
'-mms-bitfields'
This whole configuration was for my x86 machine which runs on windows
Now the good thing is that the following sample program runs correctly and i am able to see the GTK window:
===============================================================
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
/*
* simple gtk application
* author jan bodnar
* date July 1, 2008
*/
int main(int argc, char** argv) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 100);
gtk_window_set_title(GTK_WINDOW(window), "gtkapp");
gtk_widget_show(window);
g_signal_connect(window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_main();
return (EXIT_SUCCESS);
}
===============================================================#include <stdlib.h>
#include <gtk/gtk.h>
/*
* simple gtk application
* author jan bodnar
* date July 1, 2008
*/
int main(int argc, char** argv) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 100);
gtk_window_set_title(GTK_WINDOW(window), "gtkapp");
gtk_widget_show(window);
g_signal_connect(window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_main();
return (EXIT_SUCCESS);
}
but i have a second machine which is 64 bit windows!!
This machine uses the 64 bit version of eclipse and GTK+ as opposed to the 32 bit versions of these two on my previous machine
I have checked at every step and followed the steps twice
but at some point it is failing on the x64 machine:
This is the output that i get :
===============================================================
**** Rebuild of configuration Debug for project 1 ****
**** Internal Builder is used for build ****
gcc -mms-bitfields -IC:/Program Files/gtk+_win64/include/gtk-2.0 -IC:/Program Files/gtk+_win64/lib/gtk-2.0/include -IC:/Program Files/gtk+_win64/include/atk-1.0 -IC:/Program Files/gtk+_win64/include/cairo -IC:/Program Files/gtk+_win64/include/gdk-pixbuf-2.0 -IC:/Program Files/gtk+_win64/include/pango-1.0 -IC:/Program Files/gtk+_win64/include/glib-2.0 -IC:/Program Files/gtk+_win64/lib/glib-2.0/include -IC:/Program Files/gtk+_win64/include/pixman-1 -IC:/Program Files/gtk+_win64/include -IC:/Program Files/gtk+_win64/include/freetype2 -IC:/Program Files/gtk+_win64/include/libpng14 -O0 -g3 -Wall -c -fmessage-length=0 -o main.o ..\main.c
g++ -mms-bitfields -LC:/Program Files/gtk+_win64/lib -o 1.exe main.o -llibgtk-win32-2.0 -llibgdk-win32-2.0 -llibatk-1.0 -llibgio-2.0 -llibpangowin32-1.0 -llibpangocairo-1.0 -llibgdk_pixbuf-2.0 -llibpango-1.0 -llibcairo -llibgobject-2.0 -llibgmodule-2.0 -llibgthread-2.0 -llibglib-2.0 -llibintl
main.o: In function `main':
C:\Users\Administrator\workspace\1\Debug/../main.c:16: undefined reference to `gtk_init_abi_check'
C:\Users\Administrator\workspace\1\Debug/../main.c:18: undefined reference to `gtk_window_new'
C:\Users\Administrator\workspace\1\Debug/../main.c:19: undefined reference to `gtk_window_get_type'
C:\Users\Administrator\workspace\1\Debug/../main.c:19: undefined reference to `g_type_check_instance_cast'
C:\Users\Administrator\workspace\1\Debug/../main.c:19: undefined reference to `gtk_window_set_position'
C:\Users\Administrator\workspace\1\Debug/../main.c:20: undefined reference to `gtk_window_get_type'
C:\Users\Administrator\workspace\1\Debug/../main.c:20: undefined reference to `g_type_check_instance_cast'
C:\Users\Administrator\workspace\1\Debug/../main.c:20: undefined reference to `gtk_window_set_default_size'
C:\Users\Administrator\workspace\1\Debug/../main.c:21: undefined reference to `gtk_window_get_type'
C:\Users\Administrator\workspace\1\Debug/../main.c:21: undefined reference to `g_type_check_instance_cast'
C:\Users\Administrator\workspace\1\Debug/../main.c:21: undefined reference to `gtk_window_set_title'
C:\Users\Administrator\workspace\1\Debug/../main.c:22: undefined reference to `gtk_widget_show'
C:\Users\Administrator\workspace\1\Debug/../main.c:24: undefined reference to `gtk_main_quit'
C:\Users\Administrator\workspace\1\Debug/../main.c:24: undefined reference to `g_signal_connect_data'
C:\Users\Administrator\workspace\1\Debug/../main.c:27: undefined reference to `gtk_main'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 6842 ms.
===============================================================
I have checked everything (same in both machine configurations)
The project is C++ Project
Toolchain : MinGW GCC
Include paths : set
Libraries :: correctly inserted
Library search path :: Correct
' -mms-bitfields ' = added to the command line patterns
and the main file is .c in both of the machines
But why is this error
any guesses ?
The include path for the 64 bit machine are as follows:
===============================================================
C:/Program Files/gtk+_win64/include/gtk-2.0
-mms-bitfields
C:/Program Files/gtk+_win64/lib/gtk-2.0/include
C:/Program Files/gtk+_win64/include/atk-1.0
C:/Program Files/gtk+_win64/include/cairo
C:/Program Files/gtk+_win64/include/gdk-pixbuf-2.0
C:/Program Files/gtk+_win64/include/pango-1.0
C:/Program Files/gtk+_win64/include/glib-2.0
C:/Program Files/gtk+_win64/lib/glib-2.0/include
C:/Program Files/gtk+_win64/include/pixman-1
C:/Program Files/gtk+_win64/include
C:/Program Files/gtk+_win64/include/freetype2
C:/Program Files/gtk+_win64/include/libpng14
-IC:/Program
===============================================================
and the libraries are as follows:
===============================================================
C:/Program Files/gtk+_win64/lib
-LC:/Program
libgtk-win32-2.0
libgdk-win32-2.0
libatk-1.0
libgio-2.0
libpangowin32-1.0
libgdi32
libpangocairo-1.0
libgdk_pixbuf-2.0
libpango-1.0
libcairo
libgobject-2.0
libgmodule-2.0
libgthread-2.0
libglib-2.0
libintl
===============================================================
Please help
Any help is always welcome!!
Thanks
--
Bhaskar Tiwari
Freelancer Developer and Active Directory Specialist
Previously with Directory Services, Microsoft
____________________________________________________________
All we have to decide is what to do with the time that has been given to us
Personal:
===================
http://ebhakt.info/
===================
Professional:
===================
http://www.ebhakt.com/
http://fytclub.net/
http://crackzhack.net/
===================
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list