Trying to get Gtk-Fortran to work in VS2019 with Intel Fortran Compiler

I am attempting to get the gtk-fortran (Home · vmagnin/gtk-fortran Wiki · GitHub) library to compile/integrate with an existing code base that is in Visual Studio 2019 using the Intel Fortran Compiler. The existing program uses FreeGLUT to create a visual interface, but doesn’t provide any way to create UI elements other than a pop-up menu.

I got GTK-Fortran working with Code::Blocks IDE following the example on the github page, and was able to skin out the GUI that I envision using in the final tool, but trying to get the same example to build/compile in Visual Studio with the Intel Fortran Compiler is just going nowhere fast.

Any ideas? I’m really new to all of these things, so any help would be great (first time working in FORTRAN).

1 Like

Welcome @v91_bleach to the Fortran Discourse!

but trying to get the same example to build/compile in Visual Studio with the Intel Fortran Compiler is just going nowhere fast.

Can you give us more details on the problems/errors you encountered?

Under Windows, I am personally always building gtk-fortran using the MSYS2 environment, with gfortran, the same way as in Linux.

I know @han190 successfully built gtk-fortran using Intel Fortran 19:
https://github.com/vmagnin/gtk-fortran/issues/115#issuecomment-539382239
but it was under macOS and probably from command line.

Maybe some people using Visual Fortran under Windows will help…

Hey, thanks for having me :slight_smile: I was actually referred here from reddit as people said I should ask here since you (the dev of gtk-fortran) frequents this forum.

So, I copied over my compiled/built folders of gtk-fortran that were compiled using MSYS2-MINGW64 (following the guide on the github step by step). When I include just the dll file(s) in the project in VS2019, I get errors saying that it can’t find the libraries (error at ‘use gtk’). When I include the modules directory (all the .mod files), it says that it can’t use the mod files because they weren’t compiled with the Intel Fortran Compiler.

I guess what I need more than anything is a step-by-step guide of how to (re)compile/build/make the mod files and dll files using the Intel Fortran Compiler. After that it should be off to the races, at least in theory.

I can copy over exact error messages I am getting if needed, but the project is on an air-gapped computer so I would have to transpose it manually (the only reason I haven’t already).

Hope that’s better info to go off of. Sorry for being a total newbie on this stuff. I mostly work in C# and MATLAB, so this is way out of my wheelhouse.

Don’t be sorry, the Discourse is for everyone from beginner to expert! Everyone is welcome and has something to bring.

Concerning the .mod files, yes they are compiler dependent:
http://fortranwiki.org/fortran/show/Compiler+.MOD+files

Perhaps a first step would be to try to call the Intel Fortran compiler from the MSYS2 command line, with a command that will approximately be:

$ cmake -G "MSYS Makefiles" -D CMAKE_Fortran_COMPILER:FILEPATH="C://'Program Files/Intel/ifort.exe'" ..

after having corrected the path with the real one (I have not that compiler installed, so I don’t know)!
Note the double slash. I have successfully launched a Windows .exe from MSYS2 like that:

$ C://'Program Files/PuTTy/putty.exe'

Hey vmagnin,

I know this was months ago, but work just now finally got me a machine where I can both have the Intel Fortran Compiler and the ability to install my own software (MSYS2) to be able to test your suggestion above.

Unfortunately, it is giving me lots of errors when trying to specify ifort.exe as the ‘CMAKE_Fortran_COMPILER’ argument.
The command I am using, specifically, is:

cmake -G “MSYS Makefiles” -D CMAKE_Fortran_COMPILER:FILEPATH=“C://Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe” …

The error log file contains thousands of lines that read something like "C:/msys64/mingw64/share/cmake-3.20/Modules/CMakeFortranCompilerABI.F(5): warning #5117: Bad # preprocessor line

#if defined(_LP64)

-^"

And then the following block of errors after that:

C:/msys64/mingw64/share/cmake-3.20/Modules/CMakeFortranCompilerABI.F(5): warning #5117: Bad # preprocessor line

#if defined(_LP64)

-^

The command line (MSYS2 console) also gives different errors:

The Fortran compiler

"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/msys64/home/derek/gtk-fortran-gtk4/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/msys64/usr/bin/make.exe -f Makefile cmTC_27ee9/fast && /usr/bin/make  -f CMakeFiles/cmTC_27ee9.dir/build.make CMakeFiles/cmTC_27ee9.dir/build
make[1]: Entering directory '/home/derek/gtk-fortran-gtk4/build/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_27ee9.dir/testFortranCompiler.f.obj
"/C/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe"    -c /C/msys64/home/derek/gtk-fortran-gtk4/build/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_27ee9.dir/testFortranCompiler.f.obj
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

Linking Fortran executable cmTC_27ee9.exe
"/C/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe" "CMakeFiles/cmTC_27ee9.dir/testFortranCompiler.f.obj"  -o cmTC_27ee9.exe
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

link: unknown option -- s
Try 'link --help' for more information.
make[1]: *** [CMakeFiles/cmTC_27ee9.dir/build.make:98: cmTC_27ee9.exe] Error 1
make[1]: Leaving directory '/home/derek/gtk-fortran-gtk4/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_27ee9/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:38 (project)

– Configuring incomplete, errors occurred!

Any thoughts?

Can you try adding apostrophes around the path?

“C://'Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe'”

I used them in the examples in my previous messages, probably because of the space in the middle of the directory name (Program Files).

In fact, before trying to use it with CMake, the first thing to do is to verify that you can access ifort from the MSYS2/MINGW terminal, by just typing (without the $ of course):

$ C://'Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe'

You should obtain that kind of message (supposing it’s the same message than in Linux):

ifort: command line error: no files specified; for help type "ifort -help"

So, when I try typing in just the path to ifort.exe without the cmake command, it returns the error message that you said it should of no files specified.

When I try adding single quotes around the path portion of the cmake command, it returns:
$ cmake -G “MSYS Makefiles” -D CMAKE_Fortran_COMPILER:FILEPATH=“C://‘Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe’” …
– The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:38 (project):
The CMAKE_Fortran_COMPILER:

C:/'Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe'

is not a full path to an existing compiler tool.

Tell CMake where to find the compiler by setting either the environment
variable “FC” or the CMake cache entry CMAKE_Fortran_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.

I had tried the command with the single quotes as you specified first, but it gave me this, which I took to mean that my path wasn’t valid, so I tried it without and it gave me the other errors that I posted above, which sounded to me like it found the compiler but ran into errors.

I think you are right, I obtain the same error message if I give CMake a bad path under Linux.

In your error message, two things may be interesting:

CMakeFortranCompilerABI.F

and

link: unknown option -- s
Try 'link --help' for more information.
make[1]: *** [CMakeFiles/cmTC_27ee9.dir/build.make:98: cmTC_27ee9.exe] Error 1

As CMake was unable to detect correctly the compiler, it tried to compile a testFortranCompiler.f test file. It seems the .obj was correctly generated. But the linking stage failed. Is it because we try to mix Windows and Linux things?

There is a CMake option to change the linker: -D CMAKE_LINKER=/path/to/linker, see:
https://stackoverflow.com/questions/1867745/cmake-use-a-custom-linker
Maybe you should look in that direction…

Is it because we try to mix Windows and Linux things?
Probably…

I can try to start looking into changing the linker. Would the Intel Fortran Compiler have it’s own linker, or would it be using Visual Studio’s linker?

Also, is there any way to compile the Gtk-Fortran libraries using the Intel Fortran Compiler directly? What would someone use in place of cmake?

Thanks again for all the help!

Concerning linkers, I am not competent.

In the project, there is a script src/alt_build_test.sh to build the library and the examples : git pull the latest commits, as I have just updated that script in the gtk3 & gtk4 branches, on the 11th June. I have tested it successfully under MSYS2 (with the MSYS2 gfortran).

You may try to use it with ifort.exe.
The command under Linux is:

$ FC="ifort" ./alt_build_test.sh

Under MSYS2, you can try:

$ FC="C://Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe" ./alt_build_test.sh

(add apostrophes if needed…)

You may also read:
https://github.com/vmagnin/gtk-fortran/wiki/Alternatives-to-CMake

And if you know which gtk-fortran files are needed, you can also simply compile and run each example as follow, from the src/ directory :
$ gfortran glib-auto.f90 cairo-auto.f90 gdk-auto.f90 gdk-pixbuf-auto.f90 gtk.f90 ../examples/julia_pixbuf.f90 $(pkg-config --cflags --libs gtk+-3.0)

For GTK 4, it’s --libs gtk4

I tried using Cygwin (no clue why I wrote Putty here initially…) to emulate running shell script on Windows, but still was unable to make any progress going this route. ifort unfortunately is not gfortran or msys2, and it just seems to be incompatible in ways I can’t understand.

I tried a different approach of importing all of the .f90 source files from the gtk-fortran library into a new Visual Studio project and tried to compile the code using the Intel Fortran Compiler, and it seems to run to a point, then it starts spitting out errors that look like this:

error LNK2019: unresolved external symbol _gdk_pixbuf_get_rowstride referenced in function _GDK_PIXBUF_HL_mp_HL_GDK_PIXBUF_INFO||gdk-pixbuf-hl.obj|||

I get 360 such errors that all appear to follow this format. Is it missing other libraries/dependencies that are located inside of the gfortran and/or msys2 compilers? Could I pull those into the project to give it knowledge of what it’s looking for?

Again, thanks for all of your help and sorry for being so out of my depth on these things.

Putty is a SSH client, that you will use to connect to a distant machine. It does not emulate a Linux terminal on your machine.

When somebody talks about GTK, be conscious that GTK can mean the GTK library itself (with all the GUI widgets) but also the collection of libraries: GTK is just one of those libraries, but there is also GLib (on which is based GTK), Pango, Cairo, gdk-pixbuf… The error you shown is a linking error with the gdk-pixbuf library (which is used to draw pixels in an image).

When you compile a gtk-fortran program, you write something like:

$ gfortran my_app.f90 $(pkg-config --cflags --libs gtk-4-fortran)

But the pkg-config command expands like this:

`$ pkg-config --cflags --libs gtk-4-fortran

-rdynamic -mfpmath=sse -msse -msse2 -pthread -I/usr/local/include/gtk-4-fortran -I/usr/include/gtk-4.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Xlinker -R/usr/local/lib -lgtk-4-fortran -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lvulkan -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
`
Some may not be needed for gtk-fortran, but you will need GTK, GLib, gdk-pixbuf, Cairo, Pango, and a few others.

Sorry, I am not familiar with Visual Studio. And uses Windows only occasionally now… But you need to give Visual Studio access to all those needed libraries.

Note also that I remember that at the beginning of the gtk-fortran project, ten years ago, I had successfully compiled and run the examples using the gfortran Windows version and linking to the DLLs of the GTK libraries. And it was some dirty trick: I think I copied the DLL from the Gimp application (the original GTK was Gimp ToolKit) and put them in the same directory as the gtk-fortran examples. But it worked…

Maybe you should have a look at:
https://anadoxin.org/blog/bringing-visual-studio-compiler-into-msys2-environment.html/

Jumping back here, I pulled the latest version of the alt_build_test.sh script from your github and tried to run that in MSYS2 as you described here.

My output is as follows:

First it says:

$ FC=“C://Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe” ./alt_build_test.sh
Building gtk-4-fortran
Removing old files…
Compiling the GTK+ libraries and gtk_hl using C://Program Files (x86)/IntelSWTools/compilers_and_libraries_2020/windows/bin/intel64/ifort.exe

After this it then repeats almost exactly this set of outputs for each *.f90 file that is trying to be compiled:

gdk-auto.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mfpmath=sse’
ifort: command line warning #10006: ignoring unknown option ‘/msse’
ifort: command line warning #10006: ignoring unknown option ‘/msse2’
ifort: command line warning #10006: ignoring unknown option ‘/pthread’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/LC:/msys64/mingw64/lib’
ifort: command line warning #10006: ignoring unknown option ‘/lgtk-4’
ifort: command line warning #10006: ignoring unknown option ‘/lpangowin32-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lpangocairo-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lpango-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lharfbuzz’
ifort: command line warning #10006: ignoring unknown option ‘/lgdk_pixbuf-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lcairo-gobject’
ifort: command line warning #10006: ignoring unknown option ‘/lcairo’
ifort: command line warning #10006: ignoring unknown option ‘/lvulkan’
ifort: command line warning #10006: ignoring unknown option ‘/lgraphene-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lgio-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lgobject-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lglib-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lintl’

And then finally, at the end it spits out:

Compiling the examples…
bazaar
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
ifort: command line warning #10161: unrecognized source type ‘gtk.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-sup.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘unixonly-auto.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-misc.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-button.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-combobox.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-container.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-entry.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-progress.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-spin-slider.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-tree.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-chooser.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-dialog.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-infobar.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-hl-assistant.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gdk-pixbuf-hl.o’; object file assumed
ifort: command line warning #10161: unrecognized source type ‘gtk-draw-hl.o’; object file assumed
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mfpmath=sse’
ifort: command line warning #10006: ignoring unknown option ‘/msse’
ifort: command line warning #10006: ignoring unknown option ‘/msse2’
ifort: command line warning #10006: ignoring unknown option ‘/pthread’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/mms-bitfields’
ifort: command line warning #10006: ignoring unknown option ‘/LC:/msys64/mingw64/lib’
ifort: command line warning #10006: ignoring unknown option ‘/lgtk-4’
ifort: command line warning #10006: ignoring unknown option ‘/lpangowin32-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lpangocairo-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lpango-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lharfbuzz’
ifort: command line warning #10006: ignoring unknown option ‘/lgdk_pixbuf-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lcairo-gobject’
ifort: command line warning #10006: ignoring unknown option ‘/lcairo’
ifort: command line warning #10006: ignoring unknown option ‘/lvulkan’
ifort: command line warning #10006: ignoring unknown option ‘/lgraphene-1.0’
ifort: command line warning #10006: ignoring unknown option ‘/lgio-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lgobject-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lglib-2.0’
ifort: command line warning #10006: ignoring unknown option ‘/lintl’

ipo: error #11018: Cannot open gtk.o
ipo: error #11018: Cannot open gtk-sup.o
ipo: error #11018: Cannot open gtk-hl.o
ipo: error #11018: Cannot open unixonly-auto.o
ipo: error #11018: Cannot open gtk-hl-misc.o
ipo: error #11018: Cannot open gtk-hl-button.o
ipo: error #11018: Cannot open gtk-hl-combobox.o
ipo: error #11018: Cannot open gtk-hl-container.o
ipo: error #11018: Cannot open gtk-hl-entry.o
ipo: error #11018: Cannot open gtk-hl-progress.o
ipo: error #11018: Cannot open gtk-hl-spin-slider.o
ipo: error #11018: Cannot open gtk-hl-tree.o
ipo: error #11018: Cannot open gtk-hl-chooser.o
ipo: error #11018: Cannot open gtk-hl-dialog.o
ipo: error #11018: Cannot open gtk-hl-infobar.o
ipo: error #11018: Cannot open gtk-hl-assistant.o
ipo: error #11018: Cannot open gdk-pixbuf-hl.o
ipo: error #11018: Cannot open gtk-draw-hl.o
link: unknown option – s
Try ‘link --help’ for more information.

Does this help any or make any sense to you?

Yes, in those warnings you can recognize (except mms-bitfields) the options coming from the pkg-config utility, in one of my last messages. And among these options, those beginning with an l (lowercase L) are essential for linking with the GTK libraries. Hence the final errors: the object files were not generated.

You should search information on linking options in ifort for Windows, for example (but not enough information there):
https://stackoverflow.com/questions/27777477/windows-ifort-linker-library-path
It seems under Windows the ifort options are introduced by a slash / instead of a dash -

Well, I think that I finally got the GTK-Fortran libraries to compile using ifort, thanks to your script and your tip about using / instead of -.

It compiles the .f90 files and generates .mod and .obj files (instead of .o files). I tried correcting all instances of *.o to *.obj within the script, but it still fails to compile any of the examples.

Compiling the examples…
bazaar
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
link: unknown option – s
Try ‘link --help’ for more information.

But I don’t see a ‘–s’ anywhere in the script, so I’m not sure what that’s about.

After this success, I pulled the files and the compiled libraries into my actual project in VS and it was able to successfully compile there as well. So now I just have to troubleshoot my actual code to be compatible with the Intel Fortran Compiler, which I could certainly use help with, but I feel like I have already asked for too much help here as is, so feel free to ignore the following troubleshooting.

On the lines that follow the format

use gtk, only: gtk_events_pending, gtk_main, …etc

I get errors of the format

error #6580: Name in only-list does not exist or is not accessible. [GTK_EVENTS_PENDING]

but only on some of them, seemingly randomly.

If I comment out all of the ‘, only:’ portions, then these errors go away.

I then run into errors on the function from JuliaSets:

recursive subroutine pending_events ()
do while(IAND(gtk_events_pending(), run_status) /= FALSE)
boolresult = gtk_main_iteration_do(FALSE) ! False for non-blocking
end do
end subroutine pending_events

Giving:

error #6404: This name does not have a type, and must have an explicit type. [IAND]
error #6404: This name does not have a type, and must have an explicit type. [GTK_EVENTS_PENDING]
error #6363: The intrinsic data types of the arguments must be the same. [IAND]
error #6404: This name does not have a type, and must have an explicit type. [GTK_MAIN_ITERATION_DO]

Next, in my main program code, at the top on the line

use handlers

It gives me the error:

error #7002: Error in opening the compiled module file. Check INCLUDE paths. [HANDLERS]

Which I don’t understand because it’s declared in the same file, just like in the examples included with the GTK-Fortran library.

And then a bunch of errors not liking the ‘c_ptr’ declaration:

error #6457: This derived type name has not been declared. [C_PTR]

So, still a long way to go I imagine, but I’d call this major progress! Thank you so much for you help so far!

1 Like

It’s great if you have successfully build the library!

But it seems you have problems with linking the examples with the gtk-fortran modules. So you will have an avalanche of error messages.

My advice is: don’t try to fix all problems simultaneously. Just try to build the simplest example: examples/gtkzero_gapp.f90. It just opens an empty GTK window: in its code you will find a use gtk, only: and a use g, only: (g is for GLib). So you just have to successfully link that example with the gtk and g modules of gtk-fortran, and of course the GTK and GLib libraries of the GTK collection.

When you will have succeeded with that example, everything else will follow…