Author Topic: linking GTK with codeblocks?  (Read 11513 times)

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
linking GTK with codeblocks?
« on: January 04, 2016, 07:00:18 pm »
I am just learning c++, and up till now, the only code I have written has been console applications. I figured I would play around with the GTK project wizard to get a feel for it, but I can't figure out how to link codeblocks to the gtk library.

Following the instructions on the GTK download page, I installed msys2. I have no idea how to compile a pkgbuild, or what files are necessary, so I used pacman -S to download the GTK unico engine, but that didn't work, so I have started downloading every package they have under pacman -Ss gtk3.

The gtk.h file is located in "C:\msys64\mingw64\include\gtk-3.0\gtk"

Codeblocks says that it can't find an include file, which is correct, because there isn't one. I try to point the project wizard to "C:\msys64\mingw64", which is the parent directory of the include file, but then it says that it can't locate gtk.h

I apologize in advance if this is due to some failure to download the right package, but any help would be greatly appreciated.

I am running:
Windows Vista 64 bit
Codeblocks 13.12
MSYS2
and the GTK version that MSYS is trying to download is apparently GTK 3.0

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #1 on: January 04, 2016, 07:53:30 pm »
Post the link to the directions you are following.

Note: Your question will likely drift off topic for this site.
I edit this post or pm you a link to another site if that happens.

Are you using Windows 32 bit or Windows 64 bit? Windows Vista 64 bit

Edit2: I will be using Code::Blocks 15.12RC1 on Windows 7 (either 32 bit or 64 bit)

Tim S.

I am just learning c++, and up till now, the only code I have written has been console applications. I figured I would play around with the GTK project wizard to get a feel for it, but I can't figure out how to link codeblocks to the gtk library.

Following the instructions on the GTK download page, I installed msys2. I have no idea how to compile a pkgbuild, or what files are necessary, so I used pacman -S to download the GTK unico engine, but that didn't work, so I have started downloading every package they have under pacman -Ss gtk3.

The gtk.h file is located in "C:\msys64\mingw64\include\gtk-3.0\gtk"

Codeblocks says that it can't find an include file, which is correct, because there isn't one. I try to point the project wizard to "C:\msys64\mingw64", which is the parent directory of the include file, but then it says that it can't locate gtk.h

I apologize in advance if this is due to some failure to download the right package, but any help would be greatly appreciated.

I am running:
Windows Vista 64 bit
Codeblocks 13.12
MSYS2
and the GTK version that MSYS is trying to download is apparently GTK 3.0
« Last Edit: January 04, 2016, 07:55:58 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #2 on: January 04, 2016, 11:39:09 pm »
Well, the GTK windows download site gives this link for instructions on installing GTK, but those directions are are focused on programming with Gedit, apparently. I want to install gtk for use with codeblocks.

https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtk-application-on-windows/

The blog website also give some directions for compiling GTK for use with visual C++, but I'm honestly not sure how relevant to code blocks those directions will be.

https://wiki.gnome.org/action/show/Projects/GTK+/Win32/MSVCCompilationOfGTKStack#The_Dependencies

At this point, I really don't want to go around pointlessly downloading things that I really don't need, since I've already downloaded god only knows how much trying to get this running. I know that at some point I will try to use a program I built on another computer and I would hate to have to download 7 or 8 GB of content just to run a 100 mb program...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #3 on: January 05, 2016, 12:39:33 am »
Are you planning on using gtk2 or gtk3?

If it makes no difference I will use gtk2.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #4 on: January 05, 2016, 12:54:22 am »
well, I am planning to use GTK3, but when installing everything with msys2, apparently it installed both GTK3 and GTK2. As this point, I have no preference as long as I get something running correctly.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #5 on: January 05, 2016, 12:58:05 am »
I will do gtk2 under Windows 7 32 bit; this might take a few days to figure it out or just a few hours.

Then, I will start on GTK3 on Windows 7 64 bit.

If you did NOT know MSys2 32bit and 64 bit are different from each other.
(64 bit is easier in most ways)

Edit: I have no knowledge of either version of GTK.
I plan on just getting the Code::Blocks wizard sample code working with GTK2/3 using the MSys2 compiler.
Edit3: The Code::Blocks Wizard is hard coded to use GTK2; that is why I am doing GTK2 first.

Edit2: I am trying to get the MSys2 compiler to work better with Code::Blocks.

Tim S.
« Last Edit: January 05, 2016, 01:19:54 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #6 on: January 05, 2016, 01:15:18 am »
I try to run the 64 bit versions of software for compatibility issues, but I forget to mention that I'm using that version from time to time. Honestly, aside from memory allocation abilities, I'm not entirely educated about the difference. I am autodidactic in regards to computers, and from time to time I tend to overlook certain things only to find that I have to go back and learn them later when I should have learned them in the first place.

without steering too far off topic, From a programming standpoint, is there a major difference writing programs for 32 vs. 64 bit that I should be aware of?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #7 on: January 05, 2016, 01:23:56 am »
When using 32 bit DLLs in MSys2 you get a weird run-time error that requires to run a batch file to redo the base addressing for all of the DLLs. That is the major newbie issue that I stumbled over a few months, ago. This includes MSYS2 built DLLs. I had to run the batch file every month or so.

Tim S.

I try to run the 64 bit versions of software for compatibility issues, but I forget to mention that I'm using that version from time to time. Honestly, aside from memory allocation abilities, I'm not entirely educated about the difference. I am autodidactic in regards to computers, and from time to time I tend to overlook certain things only to find that I have to go back and learn them later when I should have learned them in the first place.

without steering too far off topic, From a programming standpoint, is there a major difference writing programs for 32 vs. 64 bit that I should be aware of?
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #8 on: January 05, 2016, 01:33:10 am »
I Have gotten an edited Code::Blocks SVN 10638 to build GTK2 sample.

Now, I need to switch to my Windows 7 64 bit laptop and see if that works.

If you are a Git User; I am using this branch to do my work.
https://github.com/stahta01/codeblocks_https_metadata/tree/msys2_gtk

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #9 on: January 05, 2016, 01:56:15 am »
When using 32 bit DLLs

Ok, so it's something that I'll have to look at down the road. I'm far from building applications that require the use of DLLs (I have only wrote a few very minor console applications, and those have just been modestly upgraded versions of the examples found in the C++ books I've read.

Since I'm not actually getting any formal education in the subject, and I don't personally know anyone in computer programming, I am basically learning from a few books (mostly older, prior to C++0x), let alone the newest standard), online tutorials, and browsing message boards for what information I can gather. I don't really post on them much because my questions can sometimes tend to get a little... abstract, and from what I've noticed programming message boards (understandably) aren't geared towards catering to the ultra new user. Therefore, I typically read a little bit on a particular topic, cross reference it with what the other books say about the topic, and then spend some time further researching it through online tutorials, blogs, online forums, etc. just so I can further understand it. I don't want to learn "You type this in, and the program will do this", I want to learn the how, why, and to what extent can this be optimized of the subject. Follow up questions of that nature tend to be seen as either off topic, wasting time, or trolling...

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #10 on: January 05, 2016, 02:04:51 am »
If you are a Git User

not at the moment, but I should probably check it out

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #11 on: January 05, 2016, 02:58:25 am »
I gave up on Fixing the CB Wizard for GTK3; I just do NOT have the time right now.

I am attaching an User Template for building GTK3 CB Projects using MSys2 MinGW 64 bit GCC.
It uses the Code::Blocks GCC compiler alias.

You can put User Templates into "%APPDATA%\CodeBlocks\UserTemplates"
In my case it is "C:\Users\stahta01\AppData\Roaming\CodeBlocks\UserTemplates"
Edit: I would just save the zipped file; and see if it works after unzipping and if it does do a save as template operation in CB.

Tim S.

Deleted attachment.


« Last Edit: January 16, 2016, 06:30:23 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #12 on: January 05, 2016, 05:17:44 am »
I understand completely. Thanks for the time invested. I'll try your workaround and see if I can get something going.

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #13 on: January 06, 2016, 09:50:49 am »
I tried the template that you attached, and while it loaded, nothing would compile... it got stuck at the gtk header file. I tried a few things, but nothing worked.

with that being said, I'm going to start back over from scratch and try a few things. If I can get everything working, I'll come back and post my solution.

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #14 on: January 06, 2016, 12:07:20 pm »
well, if you're still interested: I see now what the problem is. The files installed through Msys2 are, for some reason, incomplete. same thing goes for GTK2 through Msys2. I have actually managed to track down some of the necessary files (mostly .dlls) through various means, and I can now start a GTK+ project with GTK2. The Hello world sample won't compile though, it's still missing a few things. Once I get a working, compiling program with GTK2, I'll go back and try to rebuild a complete GTK3 library.

I am learning far more about code blocks than I ever intended to, but I suppose that's a good thing.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #15 on: January 06, 2016, 07:43:07 pm »
The MSys2 GTK3 Packages I added; I added all of gtk3 recommend packages.
Code: [Select]
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

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: [Select]
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"));
 
« Last Edit: January 06, 2016, 08:34:49 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #16 on: January 06, 2016, 07:52:47 pm »
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #17 on: January 07, 2016, 04:13:11 am »
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.

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #18 on: January 07, 2016, 05:43:19 am »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12361
    • Travis build status
Re: linking GTK with codeblocks?
« Reply #19 on: January 07, 2016, 08:19:22 am »
Can you record a video of this behaviour?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9592
Re: linking GTK with codeblocks?
« Reply #20 on: January 07, 2016, 11:01:08 am »
The MSys2 GTK3 Packages I added; I added all of gtk3 recommend packages.
Patch file of the changes I needed to do to CB GTK Wizard; to make it work with GTK3 and Code::Blocks 13.12.
That can only be an interim-patch. Better would be to support both version by lettings the user choose.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #21 on: January 07, 2016, 03:01:42 pm »
The MSys2 GTK3 Packages I added; I added all of gtk3 recommend packages.
Patch file of the changes I needed to do to CB GTK Wizard; to make it work with GTK3 and Code::Blocks 13.12.
That can only be an interim-patch. Better would be to support both version by lettings the user choose.

I agree; but, the OP needed it before I will have time to add the GUI choice. I am still not very good at the Scripting code changes esp. when it requires GUI stuff. But, it sounds like the OP has stopped using MSys2; so, I will likely give up helping because I decided that getting MSys2 and Code::Blocks working is what I am trying to get done right now. Will post a patch as I think is needed for GTK2/3 and MSys2 compiler in the future. After that, I plan to work on SDL1/2 CB Wizard and MSys2 patch.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #22 on: January 08, 2016, 09:36:51 pm »
Can you record a video of this behaviour?

I can probably get some screenshots, but that's about the best I can do. I don't have any sort of video capture software on my laptop.

edit: I went in to try to get the screenshots, and the behavior isn't replicating today.
As it stands, I can get a blank window to open from the tutorial code from the gtk website: http://www.gtk.org/tutorial1.2/gtk_tut-2.html
(I posted the link to the location where I got the code rather than post the code itself to save space. I copy/pasted the code verbatim fro that tutorial



When working on the hello world sample on the same page, I get 17 errors and 4 warnings:


Code: [Select]
||=== Build: Debug in newgtk (compiler: GNU GCC Compiler) ===|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c||In function 'main':|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|57|warning: implicit declaration of function 'gtk_signal_connect' [-Wimplicit-function-declaration]|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|57|warning: implicit declaration of function 'GTK_OBJECT' [-Wimplicit-function-declaration]|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|58|warning: implicit declaration of function 'GTK_SIGNAL_FUNC' [-Wimplicit-function-declaration]|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|81|warning: implicit declaration of function 'gtk_signal_connect_object' [-Wimplicit-function-declaration]|
obj\Debug\main.o||In function `hello':|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|10|undefined reference to `g_print'|
obj\Debug\main.o||In function `delete_event':|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|23|undefined reference to `g_print'|
obj\Debug\main.o||In function `main':|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|57|undefined reference to `GTK_SIGNAL_FUNC'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|57|undefined reference to `GTK_OBJECT'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|57|undefined reference to `gtk_signal_connect'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|63|undefined reference to `GTK_SIGNAL_FUNC'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|63|undefined reference to `GTK_OBJECT'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|63|undefined reference to `gtk_signal_connect'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|67|undefined reference to `g_type_check_instance_cast'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|75|undefined reference to `GTK_SIGNAL_FUNC'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|75|undefined reference to `GTK_OBJECT'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|75|undefined reference to `gtk_signal_connect'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|81|undefined reference to `GTK_OBJECT'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|81|undefined reference to `GTK_SIGNAL_FUNC'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|81|undefined reference to `GTK_OBJECT'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|81|undefined reference to `gtk_signal_connect_object'|
C:\Users\Will\Documents\learning\C++\misc\newgtk\main.c|86|undefined reference to `g_type_check_instance_cast'|
||=== Build failed: 17 error(s), 4 warning(s) (0 minute(s), 1 second(s)) ===|


While I'm not exactly an expert with GTK+, I do know that the g_print() function is a part of the Glib library (Glib is a dependency of GTK). I added an include for glib.h, and it still came up the same .
« Last Edit: January 08, 2016, 10:31:36 pm by southernsontn »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #23 on: January 09, 2016, 02:01:20 am »
If you wish to use GTK3 then find a better sample code.

You can NOT expect several year old code to work with GTK3; it did work for me with GTK2 and MSys2.

Edit: I am guessing the "tutorial1.2" means it was written for GTK1.2.
Edit2: Learn how to create a full rebuild log; this will be needed when you seek help on a site that supports GTK3.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Edit3: Link to some directions I am working on for GTK3 and MSys2
https://github.com/stahta01/cb_misc/blob/master/Notes/MSys2/Setting%20up%20MSys2%20for%20using%20GTK3%20with%20external%20CodeBlocks%20IDE.txt

Tim S.
 
« Last Edit: January 09, 2016, 02:44:27 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6800
    • My Best Post
Re: linking GTK with codeblocks?
« Reply #24 on: January 10, 2016, 01:01:37 am »
Patch that I plan to test more in the future; but, I plan to change more CB Wizards before doing that testing.

Tim S.

Deleted patch; Will post patches in a new thread when I finish testing them.

« Last Edit: January 16, 2016, 06:31:42 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline southernsontn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: linking GTK with codeblocks?
« Reply #25 on: January 13, 2016, 09:57:22 pm »
Just as an update, I finally got GTK 3 working in my code blocks installation.

In order to do so, I edited my wizard script as Stahta posted earlier, but I never could get it working correctly with the Msys2 GTK3 bundle. fortunately, I found a source online that had the GTK library bundled by itself. Once I got everything set up with this install, everything functioned like clockwork. Thanks everyone for the help, and thank you Stahta, especially.