Omer_S
(Omer S)
June 14, 2023, 10:17pm
1
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!
lb90
June 15, 2023, 8:28am
2
Hi! Could you tell us more about your build steps? Are you using Meson, vscode or Visual Studio?
lb90
June 15, 2023, 10:37am
4
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
Omer_S
(Omer S)
June 15, 2023, 11:01am
5
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
lb90
June 15, 2023, 11:06am
6
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
Omer_S
(Omer S)
June 15, 2023, 11:22am
7
Thanks for the help lb90
However, i dont understand your comment
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
system
(system)
Closed
July 15, 2023, 11:22am
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.