User forums > Using Code::Blocks
linking GTK with codeblocks?
stahta01:
The MSys2 GTK3 Packages I added; I added all of gtk3 recommend packages.
--- Code: ---pacman -S mingw-w64-x86_64-gtk3 # It takes the installer a lot of time to search the fonts folder; just wait.
pacman -S mingw-w64-x86_64-gdk-pixbuf2
--- End code ---
Patch file of the changes I needed to do to CB GTK Wizard; to make it work with GTK3 and Code::Blocks 13.12.
Tim S.
--- Code: --- gtk/wizard.script | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gtk/wizard.script b/gtk/wizard.script
index 2843dfd..82cc326 100644
--- a/gtk/wizard.script
+++ b/gtk/wizard.script
@@ -54,14 +54,14 @@ function OnLeave_GtkPath(fwd)
local dir_nomacro_inc = GetCompilerIncludeDir(dir, GtkPathDefault, GtkPathDefaultInc);
if (dir_nomacro_inc.IsEmpty())
return false;
- if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("gtk-2.0") + wxFILE_SEP_PATH +_T("gtk"), _T("gtk.h"), _T("GTK's include")))
+ if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("gtk-3.0") + wxFILE_SEP_PATH +_T("gtk"), _T("gtk.h"), _T("GTK's include")))
return false;
// verify library dependencies
local dir_nomacro_lib = GetCompilerLibDir(dir, GtkPathDefault, GtkPathDefaultLib);
if (dir_nomacro_lib.IsEmpty())
return false;
- if (!VerifyLibFile(dir_nomacro_lib, _T("gtk-win32-2.0"), _T("GTK's")))
+ if (!VerifyLibFile(dir_nomacro_lib, _T("gtk-3.dll"), _T("GTK's")))
return false;
@@ -113,14 +113,14 @@ function SetupProject(project)
if (PLATFORM == PLATFORM_MSW)
{
project.AddIncludeDir(GtkPathDefaultInc);
- project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gtk-2.0"));
+ project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gtk-3.0"));
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("cairo"));
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gdk"));
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("glib-2.0"));
// Notice GtkPathDefault*Lib* at some positions. This is correct as of 2.8.20
project.AddIncludeDir(GtkPathDefaultLib + wxFILE_SEP_PATH + _T("glib-2.0") + wxFILE_SEP_PATH + _T("include"));
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("pango-1.0"));
- project.AddIncludeDir(GtkPathDefaultLib + wxFILE_SEP_PATH + _T("gtk-2.0") + wxFILE_SEP_PATH + _T("include"));
+ project.AddIncludeDir(GtkPathDefaultLib + wxFILE_SEP_PATH + _T("gtk-3.0") + wxFILE_SEP_PATH + _T("include"));
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("atk-1.0"));
if ( IO.DirectoryExists(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gdk-pixbuf-2.0")) )
project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gdk-pixbuf-2.0"));
@@ -128,7 +128,7 @@ function SetupProject(project)
project.AddLibDir(GtkPathDefaultLib);
// add link libraries
- project.AddLinkLib(_T("gtk-win32-2.0"));
+ project.AddLinkLib(_T("gtk-3"));
project.AddLinkLib(_T("gobject-2.0"));
project.AddLinkLib(_T("glib-2.0"));
--- End code ---
stahta01:
Before running the CB GTK Wizard you need to setup the GCC Compiler as using MSys2 mingw64 gcc compiler and set it as the default compiler. If you need help on this step ask.
If you do NOT know how to edit the CB Wizards try right clicking on the GTK Wizard Icon.
Remember to save the changes.
Tim S.
southernsontn:
Thank you that worked out quite well. I had to make a few further changes, but it was nothing I couldn't figure out. I appreciate the help very much. I changed the gtk-win32-2.0 references to 3.0 references. I have tried deleting and reinstalling msys2 about 3 times, and each time I try to install GTK, it still doesn't download the complete file set, but I managed to find a different GTK3 download (not through msys2) that I still dont believe is complete, but it apparently has some of the missing files. The hello world sample still won't compile, but I believe that is just a problem of missing libraries that I'll have to try to find.
You, my friend, are a life saver.
southernsontn:
well, it seems that I'm getting alot of strange behavior. I can build the sample program once, and it comes back with virtually everything listed as "undefined references". stop code blocks and run it again, with no changes to the code, and it compiles fine. try to run it a second time (again with no changes) and the build and run options are grayed out. I may try to fix it over the next couple of hours and if that doesn't work, It looks like i'll be using QT.
oBFusCATed:
Can you record a video of this behaviour?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version