VS Code: tasks and/or makefiles don't seem to be required when using the Code Runner extension

Hi.

After my earlier thread here, I’ve migrated from Geany to VS Code, an editor I was already very familiar with, as I’m still not ready to switch to Emacs. It’s been going well, but I have one lingering question.

A few tutorials about Fortran and VS code are the ones below:

  1. iRASPA, 2021
  2. Lamm, 2020

The first one suggests using Code Runner and C/C++ Makefile Project in order to compile and run Fortran code, while the second one builds the program from VS Code’s tasks. As I was following the first tutorial, I tried to use Code Runner on a few Fortran source files without a makefile, and it simply worked up-front. My guess would be that either:

  1. Code Runner never needed makefiles to begin with (I couldn’t verify that from the project’s Github page, as Fortran support was only recently added) or;
  2. Code Runner received a recent update which made makefiles unecessary or;
  3. I’m doing something wrong and I might have problems in the future if I don’t use makefiles.

For the record, all of the Fortran source files I’ve tested with Code Runner weren’t compiled beforehand: the extension compiled them automatically.

Help would be greatly appreciated in order to verify this. Code Runner seems to be a legitimate extension, so I’m hoping I can stay with it for now; either way, learning how to use VS Code tasks will be helpful, and I plan on doing that too.

Thanks.

I am a big fan of vs code and it has helped me a lot.
I don’t think that code runner is a complete build system, it is more like a toy plugin.
You can use makefiles, but I think the cross-platform, cross-compiler cmake may be more suitable for formal projects.

I now mainly use fpm, cmake, and make to build my code in vs code. fortran-lang/fpm: Fortran Package Manager (fpm) is currently very worthy of being used in personal and open source projects.

Hope this helps.

2 Likes

Thank you for your suggestion, @zoziha. I’m currently an undergraduate, so my projects are still small and contained, but I’ll most definitely use FPM. I’ll mark this as solved.

1 Like