0

So far I've been compiling projects from within Vim by suspending it with Esc and Ctrl + Z, running make (btw, I'm using the gfortran compiler and, should it be important, using the mpifort wrapper, since the program is MPI-parallel), looking at possible errors/warnings, going back to the file(s) with fg, editing them appropriately, and so on.

The Makefile lies in the project directory prj and in this directory I run it; the source files are in prj/src/. and the Makefile pick source files from there (it does not cd); if it makes any difference, I tend to open all source files at once from the main directory by vi src/*.f90.

Now I'd like to start using :make and take advantage of the quickfix utilities to jump between errors.

When I try doing so, I see the quickfix window only contains stuff like (3 di 62): 0: with nothing after it. This also happens if the source files are in the prj directory.

How should I set errorformat and/or other options to deal with this?

EDIT

After having run :compiler gfortran, the output of :verbose set errorformat? Enter is

errorformat=%A%f:%l.%c:,%-Z%trror: %m,%-Z%tarning: %m,%-C%.%#

This is a chunk of compilation output

mpifort -g -O0 -Waliasing -Wampersand -Wcharacter-truncation -Winteger-division -Wsurprising -Wunused -Wrealloc-lhs-all -ffree-form -ffree-line-length-0 -fimplicit-none -fcheck=no-array-temps -fbacktrace -fdefault-real-8 -llapack -lblas -c src/essentials.f90 -J mod -o obj/essentials.o
src/essentials.f90:494:12:

         s = num2str(iv(1))
            1
Warning: Code for reallocating the allocatable variable at (1) will be added [-Wrealloc-lhs-all]
src/essentials.f90:497:20:

                 s = s//sep//' '//num2str(iv(i))
                    1
Warning: Code for reallocating the allocatable variable at (1) will be added [-Wrealloc-lhs-all]
src/essentials.f90:499:20:

                 s = s//' '//num2str(iv(i))
                    1
Warning: Code for reallocating the allocatable variable at (1) will be added [-Wrealloc-lhs-all]
src/essentials.f90:566:0:

     FUNCTION find_allocatable(v, n) RESULT(i)

Warning: ‘find_allocatable’ defined but not used [-Wunused-function]
mpifort -g -O0 -Waliasing -Wampersand -Wcharacter-truncation -Winteger-division -Wsurprising -Wunused -Wrealloc-lhs-all -ffree-form -ffree-line-length-0 -fimplicit-none -fcheck=no-array-temps -fbacktrace -fdefault-real-8 -llapack -lblas -c src/MPI_module.f90 -J mod -o obj/MPI_module.o
  • 2
    what happens if you do :compiler gfortran before using :make? – Mass Feb 11 '18 at 14:52
  • :make<Enter>, compilation and errors/waring flowing on the screen, <Enter> to come back in Vim, and still see (3 di 62): 0:-like empty errors. – Enrico Maria De Angelis Feb 11 '18 at 15:02
  • How are the errors formatted when you run make in the shell? What's your current errorformat? (:verbose set errorformat?) – Rich Feb 13 '18 at 9:51
  • Should it be of any relevance, I compile with mpifort, since the program is parallel (this info is in the question as well, now). – Enrico Maria De Angelis Feb 13 '18 at 10:35
  • 1
    (You also didn't answer my question about what your compiler output looks like.) – Rich Feb 13 '18 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.