Author Topic: How to use CB with GTK3 on Windows 10  (Read 1943 times)

Offline arkkimede

  • Multiple posting newcomer
  • *
  • Posts: 11
How to use CB with GTK3 on Windows 10
« on: April 22, 2018, 02:17:20 am »
Probably this is a question yet done a lot of times.
I followed the instructions reported in the www.gtk.org but installing MSYS2 and following the instruction I obtain a lot of errors.
What I ask is to redirect toward a page where is reported how to install GTK3 on Windows 10 and use it with Code Blocks.

Thank you for your patience.

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 2022
Re: How to use CB with GTK3 on Windows 10
« Reply #1 on: April 22, 2018, 02:35:59 am »
without exact error messages no help sry.....
if you have compiler errors, please note also:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Offline arkkimede

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: How to use CB with GTK3 on Windows 10
« Reply #2 on: April 22, 2018, 03:25:23 am »
The error is not on CB but installing all the component of GTK
The error is:
download to slow error
and the package is skipped.

Is not possible to download ALL GTK3 in a only and single files?


Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #3 on: April 22, 2018, 04:32:45 am »
So, ask for help from your Internet Service provider.

Please read and follow the rules.
http://forums.codeblocks.org/index.php/topic,9996.0.html

Note: If you post a direct link to the directions you tried to follow; I might try the directions and see if they work.

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #4 on: April 22, 2018, 04:46:34 am »
Found the directions https://www.gtk.org/download/windows.php

Quote
Step 1: Install MSYS2

The likely off topic problem is you failed to update MSys2 as part of step 1 of the directions.

But, I am thinking this is too off topic to help you get MSys2 installed.

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #5 on: April 22, 2018, 03:45:06 pm »
Found the directions https://www.gtk.org/download/windows.php

Quote
Step 1: Install MSYS2

The likely off topic problem is you failed to update MSys2 as part of step 1 of the directions.

But, I am thinking this is too off topic to help you get MSys2 installed.

Tim S.

Link to off site directions that might help with step 1
https://github.com/stahta01/cb_misc/blob/master/Notes/MSys2/How%20update%20MSys2%20under%20windows%2010.txt

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

Offline arkkimede

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: How to use CB with GTK3 on Windows 10
« Reply #6 on: May 04, 2018, 10:50:04 pm »
At this moment all the environment and installation of MSYS2 is correct.
I've installed MSYS2 for 64 bit machine.

If I use it like unix, the application written on UBUNTU is compiled linked and it run correctly.

Now I want to use CB.

The first question is related to the wizard of GTK.
If on the icon of GTK you select right button it is possible to edit it.

It refers to GTK2 and not GTK3 and search win32 library

So: it is possible to modify the wizard in order to use GTK3 and it can works whit 64 bit or I have to install MSYS2 with 32bit?
thanks

 

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 2022
Re: How to use CB with GTK3 on Windows 10
« Reply #7 on: May 05, 2018, 01:06:47 am »
Quote
So: it is possible to modify the wizard in order to use GTK3 and it can works whit 64 bit or I have to install MSYS2 with 32bit?
thanks
of corse it is possible...

but you don't need the script to create a gtk project, just make it by your own. But it think you have also set up a msys compiler

stahta01 can help you here...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #8 on: May 05, 2018, 02:09:26 am »
I will try to setup an project using GTK3 and MSys2 32 bit under Windows 10.
The wxWidgets projects I do it does not matter whether it is MSys2 MinGW 32 bit or 64 bit.
It should be the same for GTK3 projects.

Edit: Once, I started I remembered I did this several days ago.

Tim S.
« Last Edit: May 05, 2018, 02:18:29 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 Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #9 on: May 05, 2018, 02:22:49 am »
Unzip the file attached and try building it.
It might work; but, I will likely have to give you directions on how to setup the MSys2 MinGW GCC Compiler in Code::Blocks.
Note: To me it is clear how to setup Code::Blocks; but, newbies have a lot of problems.
I am now an expert on setting up GCC based compilers in C::B.

Edit: Link to C::B Project without the adding of main.c to it. https://github.com/stahta01/MSys2_CodeBlocks_Projects/tree/master/gtk

Edit2: Packages install command for 32 bit; change "i686" to "x86_64" for 64 bit.
Code: [Select]
pacman -S --needed --asdeps mingw-w64-i686-gcc mingw-w64-i686-gtk3

Tim S.
« Last Edit: May 05, 2018, 03:11:52 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 Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline arkkimede

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: How to use CB with GTK3 on Windows 10
« Reply #10 on: May 05, 2018, 02:43:26 pm »
I tried to compile your minimal code but error occur (C::B does not find gtk/gtk.h (see attached error.png).
I tried to update the MSYS2 environment but it it up to date (see attched update.png)
Looking in the cbp file I've see this line of code:
<Add directory="$(TARGET_COMPILER_DIR)include/gtk-$(GTK_VERSION)" />
but $(TARGET_COMPILER_DIR) is not specified so in the same file in the section environment I modified so:
<Environment>
            <Variable name="ATK_VERSION" value="1.0" />
            <Variable name="GLIB_VERSION" value="2.0" />
            <Variable name="GTK_PIXBUF_VERSION" value="2.0" />
            <Variable name="GTK_VERSION" value="3.0" />
            <Variable name="PANGO_VERSION" value="1.0" />
            <Variable name="TARGET_COMPILER_DIR" value="C:/msys64/mingw64/" />
</Environment>
but nothing change.

I do not know what else to try.
Thank you in any case for your suggestions and support

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #11 on: May 05, 2018, 04:04:17 pm »
TARGET_COMPILER_DIR is a built in user variable do NOT define it.

Post your compiler settings!!

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #12 on: May 05, 2018, 04:09:54 pm »
32 Bit Compiler Settings

Code: [Select]
Installation Directory: C:\msys32\mingw32

C Compiler:             i686-w64-mingw32-gcc.exe
C++ Compiler:           i686-w64-mingw32-g++.exe
Linker for Dyn. Libs:   i686-w64-mingw32-g++.exe
Linker for Static Libs: ar.exe
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6310
    • My Best Post
Re: How to use CB with GTK3 on Windows 10
« Reply #13 on: May 05, 2018, 04:53:10 pm »
64 Bit Compiler Settings

Code: [Select]
Installation Directory: C:\msys64\mingw64

C Compiler:             x86_64-w64-mingw32-gcc.exe
C++ Compiler:           x86_64-w64-mingw32-g++.exe
Linker for Dyn. Libs:   x86_64-w64-mingw32-g++.exe
Linker for Static Libs: ar.exe
« Last Edit: May 05, 2018, 05:05:38 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 Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline arkkimede

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: How to use CB with GTK3 on Windows 10
« Reply #14 on: May 05, 2018, 06:23:26 pm »
Thank You stahta01!
I had a wrong path to another mingw-64 compiler.
I'm now able to build and run your minimal code.

In the future, if I want to build another project, what I have to do?

  • I have to use your cbp file to start and add other files in the development
  • I have to use the wizard (GTK? Console? other?)
  • Something else

And just another info:
How to add all the library need (cairo, gdk_pixbuf, etc): I have to add all the .dll or .a file in the section
Settings->Compiler->Linker Setting-> Add link library
or in other way?


Thank You again.
« Last Edit: May 05, 2018, 06:52:47 pm by arkkimede »