User forums > General (but related to Code::Blocks)

Configuring Code Blocks in Windows to create GTK applications when using Msys2

<< < (2/3) > >>

AndrewCot:
I would suggest starting with a GTK tutorial. There are a bunch on the internet.
The following is an example:https://docs.gtk.org/gtk3/getting_started.html

stahta01:

--- Code: ----------------- Build: Debug in minimal GTK3 (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -g -IC:\msys64\mingw64\include\gtk-3.0 -IC:\msys64\mingw64\include\glib-2.0 -IC:\msys64\mingw64\lib\glib-2.0\include -IC:\msys64\mingw64\include\pango-1.0 -IC:\msys64\mingw64\include\cairo -IC:\msys64\mingw64\include\gdk-pixbuf-2.0 -IC:\msys64\mingw64\include\atk-1.0 -IC:\msys64\mingw64\include\harfbuzz -c H:\repos\git\devel\IDE_git_repos\MSys2_CodeBlocks_Projects\gtk\main.cpp -o obj\Debug\main.o
g++.exe  -o bin\Debug\gtk3_msys2.exe obj\Debug\main.o   -lgtk-3 -lgobject-2.0 -lglib-2.0
Output file is bin\Debug\gtk3_msys2.exe with size 125.40 KB
Process terminated with status 0 (0 minute(s), 5 second(s))
0 error(s), 0 warning(s) (0 minute(s), 5 second(s))
 
--- End code ---

stahta01:
After looking at my working build log and one of the failed ones, it looks like an bad toolchain setup.
Edit: And, likely the missing libs from library linker list

This is my setup.

Compiler Installation Dir: C:\msys64\mingw64
C Compiler: gcc.exe
C++ Compiler: g++.exe
Linker for Dynamic Libs: g++.exe
Linker for static libs: ar.exe
Res. Compiler: windres.exe
Make program: mingw32-make.exe

Additional Paths: $(TARGET_COMPILER_DIR)../usr/bin

Tim S.

stahta01:
If the poster would post the build log instead of the build messages it would be easier to help them.

Tim S.

AndrewCot:
The project in the zip file did not have any link libraries and therefore will fail.

The tutorial examples include linking with libraries and run.
If you add the following then the project will work, if you have the right MSYS2 packages installed:        <Compiler>            <Add option="`pkg-config --cflags gtk+-3.0`"/>
        </Compiler>
        <Linker>
            <Add option="`pkg-config --libs gtk+-3.0`"/>
        </Linker>

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version