User forums > Using Code::Blocks

CodeBlocks 64bit, MSys2 and GTK

(1/2) > >>

tumanovalex:
Hello!
The program compiles normally without static linking. When I try to compile programs with static layout in release mode (I have attached a screenshot of the settings), I receive messages:

--- Code: ---||=== Build: Release in gtkLearning (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lgtk-4: No such file or directory|
ld.exe||cannot find -lgraphene-1.0: No such file or directory|
||error: ld returned 1 exit status|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|

--- End code ---
I tried to add libraries to the linker settings in release mode, but nothing worked for me.
Please help me fix the project.

stahta01:
Did you try changing linker option


--- Code: ---pkg-config --libs gtk4
--- End code ---

to


--- Code: ---pkg-config --libs --static gtk4
--- End code ---

I have no idea if it will work or not.

Tim S.

stahta01:
FYI: Posting the Build Log instead of the Build Messages might help you to get help!

Tim S.

tumanovalex:
I installed GTK4 with the command pacman -S mingw-w64-x86_64-gtk4.
Build log:
--- Code: ----------------- Clean: Release in gtkLearning (compiler: GNU GCC Compiler)---------------

Cleaned "gtkLearning - Release"

-------------- Build: Release in gtkLearning (compiler: GNU GCC Compiler)---------------

gcc.exe -Wall -O2 -std=c23 -m64 -IN:\msys64\mingw64\include -IN:\msys64\mingw64\include\gtk-4.0 -IN:\msys64\mingw64\include\cairo -IN:\msys64\mingw64\include\gdk -IN:\msys64\mingw64\include\glib-2.0 -IN:\msys64\mingw64\lib\glib-2.0\include -IN:\msys64\mingw64\include\pango-1.0 -IN:\msys64\mingw64\include\atk-1.0 -IN:\msys64\mingw64\include\gdk-pixbuf-2.0 -IN:\msys64\mingw64\include\graphene-1.0 -IN:\msys64\mingw64\include\harfbuzz -IN:\msys64\mingw64\lib\graphene-1.0\include -c N:\MyProgramming\gtkLearning\main.c -o obj\Release\main.o
gcc.exe  -o bin\Release\gtkLearning.exe obj\Release\main.o  -LN:/msys64/mingw64/bin/../lib -lgtk-4 -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -

lcairo -lvulkan-1.dll -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -s -static-libstdc++ -static-libgcc -static -m64  N:\msys64\mingw64\lib\libgtk-4.dll.a N:\msys64\mingw64\lib\libgraphene-1.0.dll.a -mwindows
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgtk-4: No such file or directory
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: have you installed the static version of the gtk-4 library ?
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgraphene-1.0: No such file or directory
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: have you installed the static version of the graphene-1.0 library ?
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---

Grit Clef:

--- Code: ---pacman -S mingw-w64-x86_64-gtk4
--- End code ---
seems to install the gtk4 libraries for dynamic linking only. I don't see a static build for gtk4 in Msys2's packages.

Navigation

[0] Message Index

[#] Next page

Go to full version