GTK 3.0 lib file is missing

I am trying to run a program using rust and GTK

my code compiled all OK besides one error : = note: LINK : fatal error LNK1181: cannot open input file ‘gtk-3.lib’

I used MSYS2 to check if the GTK 3.0 was indeed installed and got this: mingw-w64-x86_64-gtk3-3.24.38.r0.g3e6fd55e-1 is up to date

I tried manually locating the gtk-3.lib file but couldn’t find it.

What am I missing? can someone help me out please ?

A new rust fan here. THANKS!

Hi! Could you tell us more about your build steps? Are you using Meson, vscode or Visual Studio?

Sure, I’m using VSC 2023

As you’re using MSYS2, it would be best to use the compiler from MSYS2 (GCC or CLang). See Get Started with C++ and Mingw-w64 in Visual Studio Code for a guide on configuring VSCode w/ MSYS2.

After that is done and everything works, you can use any library you want from MSYS2 (like GTK3) thanks to pkg-config: c++ - How to use `pkg-config gtkmm-3.0 --cflags --libs` in the Visual Studio Code - Stack Overflow

Thanks for the links , I did follow them to ta teeth and still getting the same error

Cannot find gtk-3.lib file

Like I said before, I cannot find this file manually as well even after installing and re installing the gtk packages continuously.

Help would be appreciated :slight_smile:

It seems that you’re using a MSVC-based toolchain, because GTK-3.lib is the naming scheme used by MSVC, not GCC. Did you install either vcpkg or gvsbuild?

Either way, post here your tasks.json, launch.json, c_cpp_properties.json files and we’ll see how to adjust them

Thanks for the help lb90

However, i dont understand your comment :confused:

I am using VSC and writes my code in RUST, I have 1 rust file with the source code and 1 TOML file.

1 tasks json file includes
{
“version”: “2.0.0”,
“tasks”: [
{
“label”: “Build”,
“type”: “shell”,
“command”: “gcc”,
“args”: [
“-o”,
“output”,
“your_source_file.c”,
“-I”,
“C:/msys64/mingw64/include/gtk-3.0”,
“-L”,
“C:/msys64/mingw64/lib/gtk-3.0”,
“-lgtk-3”
],
“group”: {
“kind”: “build”,
“isDefault”: true
}
}
]
}

Omer

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.