Compiler with visual studio code

hello
I am a student and I would like to compile a program whose name is simple.f90 and this program calls for nearly 5 subroutines and 6 modules. I would like to do it with visual studio-code which I have just installed and of which I have no experience.
some subroutines and modules are in Fortran 77 and others in Fortran 90.
the author of this program made it with gfortran on linux system. I have more of a Windows 10 system and I am looking for the Fortran compiler on Windows that will be able to compile this program.
I tried with the silverfrost plato compiler but it doesn’t work (it doesn’t recognize certain expressions) and I would like this time to try with visual studio-code but I don’t know how to set up a project on vs code
I really need help on this and if necessary I can send the file with all the programs.

1 Like

Hi Franklin. Welcome to the Fortran Discourse. VS Code is ultimately a code editor. It does not come with any compilers. There are extensions like fortls that help with writing code but, you would need to install a compiler in addition to VS Code to build your codes.

The GNU Compiler Collection (GCC) builds are available for Windows here: GCC builds. You could also use other free-to-use compilers like intel’s compiler. To start off you could download and install GCC in your Windows OS and try to compile your code. Which leads me to ask are you able to build the code in linux? What are the steps you are following to build the code in linux? You could try to reproduce the same in windows with gfortran & co.

Alternatively, if you are familiar with Microsoft Visual Studio IDE, intel compiler should integrate easily with it. See here for details

You should upload the code if you are able. It will make things easier.

3 Likes

Try the Approximatrix ‘Simply Fortran’ which is a nice little dev environment for gfortran.
https://simplyfortran.com

1 Like

Something else you could try to do, especially since you mentioned you’re a student, is to install virtualization software like VirtualBox or VMWare on your Windows machine, then create a virtual machine for a beginner-friendly Linux distro like Linux Mint, then run the Fortran code in the virtual machine.

Not going to lie, it’ll take a fair amount of work the first time you do it, so if your only goal is “I needed to run this code for an assignment yesterday”, it’s not a good idea. Also not a fantastic idea if the code is compute-intensive, but I’m guessing it’s not since you’re planning on running it on your laptop. But becoming comfortable with virtualization (and its sister technology containerization) and Linux will pay off dividends in the long run.

The Windows Subsystem for Linux is also an option. Ubuntu and opensuse are both available from the microsoft store and it is pretty ease to install gfortran. The killer is probably vi :frowning:

1 Like

You can use WSL with Visual Studio Code, the integration should be basically flawless, see: Developing in the Windows Subsystem for Linux with Visual Studio Code

Thanks for your reply i combinate gcc and vs code so the vs code i have now is working like gcc compiler. I want know how to rum an existIng project on vs code

I know simple fortran but i have to pay

Thanks for reply i try it now (the wsl)

see this page: text editors and configuration

Thanks for this i check it now

Free for a month. that might be long enough to get the code compiled and running and sort out all your other issues with other environments

1 Like