User forums > Help
Code::Blocks and GTK+ compile-link in Windows over KMD.EXE
stahta01:
GTK Works for me; I used the CB GTK Wizard.
I then erased the CB Wizard Search Directory and Library list and added these lines
In other linker options:
`pkg-config --libs gtk+-2.0`
In "Compiler Settings" (Other Options)
`pkg-config --cflags gtk+-2.0`
I also had to added the bin folder containing pkg-config to the CB search path.
There is at least three ways to do that; I used Compiler Global Settings "additional paths"
The above also worked for me; Note, I had to remove my Vala installation because it interfered with the results of the pkg-config command and the MinGW GCC Compiler I was using in Code::Blocks.
NOTE: If YOU continue to post without asking any questions; I will consider you to NOT want any help!!!
In English an questions end in a question mark "?".
NOTE: If you get errors post them.
Edit: The GTK I am using is http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip
Tim S.
sklimkin:
Thanks, Tim.
--- Quote from: stahta01 on June 16, 2012, 05:58:22 am ---GTK Works for me; I used the CB GTK Wizard.
In other linker options:
`pkg-config --libs gtk+-2.0`
In "Compiler Settings" (Other Options)
`pkg-config --cflags gtk+-2.0`
The above also worked for me; Note, I had to remove my Vala installation because it interfered with the results of the pkg-config command and the MinGW GCC Compiler I was using in Code::Blocks.
--- End quote ---
--- Quote ---I also had to added the bin folder containing pkg-config to the CB search path.
There is at least three ways to do that; I used Compiler Global Settings "additional paths"
--- End quote ---
I have made all these things.
Compiler Global Settings "additional paths" - I do not find such bookmark.
--- Quote ---NOTE: If YOU continue to post without asking any questions; I will consider you to NOT want any help!!!
In English an questions end in a question mark "?".
--- End quote ---
From my observations (and me 62 years) the question not always comes to an end with a question sign. But it is possible and so:
What it is necessary to specify to system that the executed file received in CodeBlocks was executed out of CodeBlocks environment, for example from windows-explorer???
Thus (I remind) it is a question of the program using the compiler gcc and libraries GTK+ in OS Windows.
To a question: GTK and PATH to include-files and libraries in Win32
---------------------------------------------------------------------
For "purity of experiment" has loaded project Code::Blocks Win32 "gtk4" in virtual machine VMware player Windows-XP.
In system all is installed by default:
C:\Program Files\CodeBlocks
C:\Gtk +
In a system variable:
PATH=C:\WINDOWS\system32; C:\WINDOWS; C:\WINDOWS\System32\Wbem; c:\Program Files\ATI Technologies\ATI.ACE\Core-Static; C:\FPC\2.6.0\bin\i386-Win32
The project which was compiled also a file gtk4.exe was executed how I have described in the previous message, now isn't compiled.
I think that it is result of absence in system variable PATH of such things as: C:\GTK+ C:\GTK+\lib and so on.
By reviewing of error messages Code::Blocks it was necessary will add in setting of the project the following:
-> Search directories -> Compiler
C:\Gtk+\lib\gtk-2.0\include
C:\Gtk+\include\cairo
-> Linker settings -> Link libraries:
C:\Gtk+\lib\glib-2.0.lib
C:\Gtk+\lib\gtk-win32-2.0.lib
C:\Gtk+\lib\gdk-win32-2.0.lib
C:\Gtk+\lib\gobject-2.0.lib
After this compiled-linked executable gtk4.exe
At execution gtk4.exe
System error message - It was not possible to find components:
... ... libgdk-win32-2.0-0.dll not found. (C:\GTK+\bin)
and in C::B window "Logs and others --> Build log" prints:
Checking for existence: C:\projects\codeblocks\gtk4\bin\Debug\gtk4.exe
Executing: "C:\projects\codeblocks\gtk4\bin\Debug\gtk4.exe" (in C:\projects\codeblocks\gtk4\.)
Process terminated with status -1073741515 (0 minutes, 13 seconds) - in red color line
--- Quote ---NOTE: If you get errors post them.
Edit: The GTK I am using is http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip
--- End quote ---
Lines above the citation just about errors.
gtk+-bundle_2.24.10-20120208_win32.zip - I also use this distribution kit.
stahta01:
Post the full build log (after turning on Full Logging). Do a re-build so I can see the full and complete build log.
It works for me; but, since you do NOT wish to do it the normal way or the way I suggested using pkg-config.
(Doing it with just the CB Wizard, I did have to add search folder.)
But, using the pkg-config works perfectly without any search folders in the project.
Doing both ways together at the same time means it is much harder to find the real point of failure.
I consider you working on your own; I will check this thread from time to time; But, since it is no problem in Code::Blocks.
It is really your lack of Using Code::Blocks combined with a communication issue that is the problem.
NOTE: This thread is NOW going off topic for the Code::Blocks site; so, it could be locked at any time.
The sample code works perfectly for me. Added to post because I have no idea what code you are compiling.
--- Code: ---#include <stdlib.h>
#include <gtk/gtk.h>
static void helloWorld (GtkWidget *wid, GtkWidget *win)
{
GtkWidget *dialog = NULL;
dialog = gtk_message_dialog_new (GTK_WINDOW (win), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hello World!");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
int main (int argc, char *argv[])
{
GtkWidget *button = NULL;
GtkWidget *win = NULL;
GtkWidget *vbox = NULL;
/* Initialize GTK+ */
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
gtk_init (&argc, &argv);
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
/* Create the main window */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (win), 8);
gtk_window_set_title (GTK_WINDOW (win), "Hello World");
gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
gtk_widget_realize (win);
g_signal_connect (win, "destroy", gtk_main_quit, NULL);
/* Create a vertical box with buttons */
vbox = gtk_vbox_new (TRUE, 6);
gtk_container_add (GTK_CONTAINER (win), vbox);
button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (helloWorld), (gpointer) win);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect (button, "clicked", gtk_main_quit, NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
/* Enter the main loop */
gtk_widget_show_all (win);
gtk_main ();
return 0;
}
--- End code ---
Tim S.
stahta01:
--- Quote from: sklimkin on June 17, 2012, 09:28:29 pm ---I think that it is result of absence in system variable PATH of such things as: C:\GTK+ C:\GTK+\lib and so on.
--- End quote ---
You NEED to have the C:\GTK+\bin folder in the System Path.
You NEED to have a working MinGW GCC C Compiler or other C Compiler installed.
If NOT using a MinGW GCC C Compiler, STATE that!
Tim S.
sklimkin:
--- Quote from: stahta01 on June 17, 2012, 11:23:28 pm ---You NEED to have the C:\GTK+\bin folder in the System Path.
You NEED to have a working MinGW GCC C Compiler or other C Compiler installed.
If NOT using a MinGW GCC C Compiler, STATE that!
Tim S.
--- End quote ---
Hello, Tim.
Thanks for attention and the detailed answer.
I have written you the answer with a result illustration, but it will explicitly overload a subject. Therefore has packed it into archive and I give the reference for downloading.
http://www.mediafire.com/?ayau3adanvccqbc
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version