[makefile:14: ioapi2uam.o] Error 1: Nonnegative width required in format string at (1)

Hi everyone,
I faced the following error when executing the IOAPI2UAM Makefile during the process of building the MEGANv3.2 code:

How can I solve this issue? Thank you for any help in advance.

Please follow this guidance.


  1. search the forum for issues simllar to yours.
    Search for MEGAN related issues.

  2. follow the tips available from previous users, to see if it resolves your issue.

  3. Note: MEGAN is a third party code, so please ALSO read the developer documentation and contact the developer directly.

After you have tried solving the issue on your own using tips from the community.

  1. For codes managed with git, or obtained from github, please include the link to the github repository, and indicate what branch you are using.

cd [your_local_git_repo]

git remote -v

git branch

If the code was not obtained from a git repository, please include version of the code you are using, and include a link of where the code was obtained.

  1. Include information about whether you are using a computer that uses modules to load the compiler environment

module avail

  1. If your system contains modules, please indicate what modules you had loaded when you tried to compile the code.

module list

  1. Include information about the OS and compiler type and compiler version.

(if using modules, this will depend on what module you load in the above steps.)

for GNU compiler:
gcc --version
gfortran --version

For intel compiler
ifort --version

Thank you for your response and sorry for the lack of information in my post.
I searched previous posts for a report of a similar problem but couldn’t find a similar issue report.
The problem arises when executing the IOAPI2UAM makefile during the process of building the MEGANv3.2 code. I got the MEGANv3.2 codes from:

I use Ubuntu 20.04.2 LTS, and the system doesn’t use modules. Moreover, gcc version = 9.4.0 and gfortran version = 9.4.0.

This is appears to be an error with the formatting of the write statement.

My solution was to comment out line 165 and line 299, as they appear to be debugging statements.

Error message after running make using the gcc compiler and compiler options.

165 | write(*,‘(2(i,f))’) ibdate,btime,iedate,etime
| 1
Error: Nonnegative width required in format string at (1)

299 | write(*,‘(a,2(i,f))’)'Writing ',ibdate,btime,iedate,etime
| 1
Error: Nonnegative width required in format string at (1)
make: *** [ioapi2uam.o] Error 1

Added a comment before line 165 and 299 as follows:

`      write(*,'(/,A)')'Output period (start date/time & end date/time):'
c      write(*,'(2(i,f))') ibdate,btime,iedate,etime
        write(MUNIT) ibdate,btime,iedate,etime
c        write(*,'(a,2(i,f))')'Writing ',ibdate,btime,iedate,etime

Then it compiled successfully.

1 Like

Another option is to fix the format string.
Try changing the format string I to Iw where w is a positive number.

Thank you for your suggestion. This solved the problem.