I am working on a Fortran program with VS solution. I followed the guide for installing gtk3 on “GitHub - wingtk/gvsbuild: GTK stack for Windows”. Then followed the following guide for creating the static library in VS community, “Trying to get Gtk-Fortran to work in VS2019 with Intel Fortran Compiler - #21 by v91_bleach”. When I try to run the project, I ran into the popup of “The code execution cannot proceed because glib-2.0-0.dll was not found …”. Same for some other dll.
I have done the command “$env:Path = “C:\gtk-build\gtk\x64\release\bin;” + $env:Path” to add the path with administrator in powershell and also manually added the path to the environment variables. In another PC, I have tried adding the dll into the System32 folder directly and worked, but dont think that this is a good practice. Thus, I would like to ask anyone who knows how to fix this issue!
Any help would be great! Thank you.
I don’t have much of a solution for you as I’m not familiar with GTK-Fortran, but you should verify that
C:\gtk-build\gtk\x64\release\bin actually contains the DLL.
In general I can recommend the application Dependencies for debugging problems like this: GitHub - lucasg/Dependencies: A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.
If you load your exe in it the application will tell you exactly which DLLs it tries to load at startup. It will also show the location of the DLLs Windows was able to find. It could be worth using it on your application to see exactly what’s missing.
An alternative to putting the DLLs into System32 is also to put them in the same folder as the exe-file.
Thank you for the suggestion! For now, I guess I will just pull the dll in the folder with the exe for simplicity, as this is at least more organised than just placing them in system 32.
I have no experience with MS Windows programming, but I’m guessing that $env:Path is the search path for executables. You need instead to change the search path for libraries, or to add that search path explicitly when you load the program. I know how to do those things on unix/posix machines, but there must be some similar way on Windows machines too.
I have just found that post about the installation in Windows of gtk-fortran + Visual Studio 2022 + Intel Fortran:
There are explanations about setting the path to DLLs. I don’t know if that could fix your problem. But that blog may be interesting for Windows users wanting to start with gtk-fortran.