Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28434 Discussions

How to use F03GL with Intel oneAPI 2023 Fortran and VS 2022


I want to realize the 3D graph in Intel oneAPI Fortran and VS 2022 by using F03GL (Fortran 2003 Interface to OpenGL) mixed programming of Fortran and C/C++ for my application. The F03GL library ( from only provides the sources codes of OpenGL_gl.f90, OpenGL_glu.f90, OpenGL_glut.f90, OpenGL_freeglut.f90, OpenGL_openglut.f90 and glut_fonts.c. However, I always encounter the same type fatal errors of "error LNK2019: unresolved external symbol_..." when I do this like:

  1. I firstly compile these interface source code files OpenGL_gl.f90, OpenGL_glu.f90, OpenGL_glut.f90, OpenGL_freeglut.f90, GLUT_fonts.c to obtain the corresponding object files of opengl_gl.obj, opengl_glu.obj, opengl_glut.obj, opengl_freeglut.obj, glut_fonts.obj by use "icl /c" and "ifort /c" compiler commands in the Intel oneAPI command prompt for Intel 64 for Visual Studio 2022, and found those libraries of opengl32.lib, glu32.lib freeglut.lib from web.
  2. Then I put all these obj and lib files, and test example such as sphere.f90 into the same directory, and compile and link these files with the command: 

>ifort sphere.f90 opengl_gl.obj opengl_glu.obj opengl_freeglut.obj opengl32.lib glu3
2.lib freeglut.lib


>ifort sphere.f90 opengl_gl.obj opengl_glu.obj opengl_freeglut.obj

After exexuting the above command, the 45 messages of error LNK2019 are shown in CMD window, such as:

sphere.obj : error LNK2019: unresolved external symbol _glutInitDisplayMode referenced in function _MAIN
sphere.obj : error LNK2019: unresolved external symbol _glutCreateWindow referenced in function _MAIN

opengl_freeglut.obj : error LNK2019: unresolved external symbol _glutTimerFunc referenced in function _OPENGL_GLUT_mp_GLUTTIMERFUNC_F03
opengl_freeglut.obj : error LNK2019: unresolved external symbol _glutInit referenced in function _OPENGL_GLUT_mp_GLUTINIT_F03

These error messages mean that all opengl, glut or freeglut functions cannot be found by the linker.  This is also so when I  include those files in a Visual Fortran project and then along with the same test example, and add OpenGL32.lib, GLU32.lib and freeglut.lib in Additional Dependencies of "Linker"--"Input" in properties setting page of VS 2022 IDE.

I always read the "Help for compilation of F03GL with IVF" posted in, but I didn't understand the detailed method as said by Gregory (‎11-04-2009 08:40 PM).


Now I don't know how to solve this problem.  Can any experienced expert or specialist help me about this?

Many thanks in advance!



0 Kudos
10 Replies
Honored Contributor III

While I am not a user of F03GL, I do use a predecessor (F90GL) of this in my Fortran programs. My suspicion is that the archive you downloaded and then built produce the libraries to integrate an interface between your Fortran application and the OpenGL C (C++) library. IOW this does not include the OpenGL library itself. You must (build) link this library with your application as well. These librarys may be the OpenGL32.lib and GLU32.lib you mentioned.

*** Note, if you are building a 64-bit application, the suffix G...32.lib might indicate these are 32-bit libraries. I suggest you look at the OpenGL to see where to obtain the 64-bit libraries (or source).


Jim Dempsey

0 Kudos

Dear Jim,

Thanks for your suggestion.

But before this, I also tried to use 64-bit OpenGL_gl*.lib by precompiling openggl_gl*.f90 and freeglut.lib (64-bit, from web), glu32.lib, both in CMD mode and Visual Fortran project, but this type of error LNK2019 still appears during linking.

But I could not obtain 64-bit glu32.lib from web. However, in the my memory glu32.lib also can be used for 64-bit application using for MSVC++ of VS 2022. 


0 Kudos
Honored Contributor III

FWIW On my system (with F90GL) I link using


in the include path

(there is also a \F90GL\f90gl-1.2.15-ifort\lib32)

In the lib64 folder, there is a glut32.lib and glut32.dll  (I am on Windows)

The binary difference between lib32\glut32.lib and lib64\glut32.lib shows they were compiled with different configurations.

The 32-bit .lib has the symbols decorated @NN suffix and _ prefix



More instructive may be the comparison of the glut32.dll's


This clearly shows they were compiled with different configurations (64-bit vs 32-bit)

Try looking at:

Your system may have the (64-bit) OpenGL32.lib lurking around:

C:\>dir "Program Files (x86)\OpenGL32.lib" /s /b
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\OpenGL32.Lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\IA64\OpenGL32.Lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64\OpenGL32.Lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\OpenGL32.Lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\OpenGL32.Lib
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\SDK\ScopeCppSDK\vc15\SDK\lib\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm64\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\OpenGL32.Lib
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\OpenGL32.Lib

If you issue the same dir command on your system, you should find the appropriate ...\x64\OpenGL32.Lib file to add to your Properties | Linker | Input | Additional Dependencies


Jim Dempsey

(post back if you have success, as others may be in the same boat)




0 Kudos

Dear Jim,

Thanks a lot for your useful suggestion.

I have found the 64-bit glu.lib and opengl32.lib according to your instrction using "C:\>dir "Program Files (x86)\OpenGL32.lib" /s /b" and "C:\>dir "Program Files (x86)\GLU32.lib" /s /b" (before this I never thought of searching for files that come with the windows system like this), and copied them into my f03gl library. Combining the library files of opengl_gl.obj , opengl_glu.obj, opengl_freeglut.obj, opengl32.lib, glu32.lib, and glut64.lib generated by the following command line in CMD window of "Intel oneAPI  command prompt for Intel 64 for Visual Studio 2022":

>ifort /c /Qm64 opengl_gl.f90

>ifort /c /Qm64 opengl_glu.f90

>ifort /c /Qm64 opengl_glut.f90

For a 64-bit application such as blender.f90 from the F03GL library ( from, input the following compiling and linking command:

 >ifort /Qm64 blender.f90 opengl_gl.obj opengl_glu.obj opengl_freeglut.obj opengl32.lib glu32.lib glut64.lib

CMD window displays:

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.35.32215.0
Copyright (C) Microsoft Corporation. All rights reserved.



Everything is OK


Thank you once again.



0 Kudos
Honored Contributor III

Thanks for posting this. When I get some time, I will integrate F03GL into my programs. I am not sure if any new features have been added or bug fixes made.

Jim Dempsey


0 Kudos


The most important is that it can work with Intel oneAPI 2023 Fortran and VS 2022, f90gl also does.

You can use freely these graphic library with your need.

0 Kudos
Honored Contributor II

Some year back I downloaded F03GL (and still use it) but I recall I had to add !DEC$ ATTRIBUTES STDCALL :: xxxxx to every interface  and I think there were one or two interface bugs that cropped up. Which F03GL did you use and did it work out of the box or need tweaking?

GLU I ditched  as I found it a bit clunky to use. I make my own parametric revolve objects that give a vertex stream for rendering which was faster and more versatile. I included source code (convert C to Fortran) for gluproject/gluunproject and that was the end of GLU for me.



0 Kudos

Dear andrew,

download the F03GL library ( from, and tested all examples from compressed, everyone without any change is OK.

A compiling and linking parameter of "/Qm64" is used as a 64-bit application example. OpenGL32.Lib, GLU32.Lib are from my Windows 11 x64 operation system by searching according Jim's instrction using "C:\>dir "Program Files (x86)\OpenGL32.lib" /s /b" and "C:\>dir "Program Files (x86)\GLU32.lib" /s /b" , and copied these two library files from "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\" directory.  The static 64-bit library file, glut64.lib, and dynamic library glut64.dll (neseded for running .exe) is from web (  


For an example modview.f90 from a successful compiling and linking command like:

>ifort /Qm64 modview.f90 opengl_gl.obj opengl_glu.obj opengl_freeglut.obj opengl32.lib glu32.lib glut64.lib

and for blender.f90:

>ifort /Qm64 blender.f90 opengl_gl.obj opengl_glu.obj opengl_freeglut.obj opengl32.lib glu32.lib glut64.lib

Hope to have help to you.



0 Kudos
Honored Contributor II

OK that is the same F03GL that I have used OK for years but all those interfaces are all bind(c,name=....)

That will not give stdcall call convention with intel or gfortran in both cases you need to add a directive for stdcall  




Did you use a compiler option for that source for stdcall maybe?  If you didn't you would get lots of unresolved routines on  a 32bit build because of stdcall name decoration but on 64bit it wouldn't give any  name link errors but maybe the stack clean up at runtime would be bad.

0 Kudos

That compressed have been updated to Feb 2022.

I have still not tested the compiling and linking the application examples for 32-bit, and also investigated the change of stack at running.

Perhapes you are right about this, but for me it is OK if it can normally run.

0 Kudos