Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
871 views
in Technique[技术] by (71.8m points)

fortran - Error: Nonnegative width required in format string at (1)

I'm trying to compile a piece of code with gfortran and it's failing with the following error:

Error: Nonnegative width required in format string at (1)
../src/powmes.f90:410.20:
     write(lunit,'(I,E,E,E)') wavenum(k),power(k),nmodes(k),errorexpan(k)

414   if (filepower_fold(1:1) /= '#') then
415      fileout=trim(filepower_fold)//'.waven'
416      if (verbose) write(*,*) 'Output '//trim(fileout)
417      open(file=fileout,form='formatted',status='unknown',unit=lunit,err=2)
418      do k=0,ngrid/2
419         do ifold=0,nfoldpow-1
420            write(lunit,'(I,$)') waven(k,ifold)
421         enddo
422         write(lunit,'(I)') waven(k,nfoldpow)
423      enddo
424      close(lunit)

How can I compile this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As already answered, you need to specify widths. Something like ES14.5 might work well for the floating point format. There is a short cut for the integer format: I0 will cause the compiler to use the number of digits needed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...