News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to use CB with GTK3 on Windows 10

Started by arkkimede, April 22, 2018, 02:17:20 AM

Previous topic - Next topic

arkkimede

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.

BlueHazzard


arkkimede

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?


stahta01

So, ask for help from your Internet Service provider.

Please read and follow the rules.
http://forums.next.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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: stahta01 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.

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

arkkimede

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


BlueHazzard

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...

stahta01

#8
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#9
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.

pacman -S --needed --asdeps mingw-w64-i686-gcc mingw-w64-i686-gtk3


Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

arkkimede

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

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

32 Bit Compiler Settings


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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#13
64 Bit Compiler Settings


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

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

arkkimede

#14
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.