Fixing Nonnegative and Positive Width Errors in Fortran Code Format Strings

  • Context: Fortran 
  • Thread starter Thread starter MrElec
  • Start date Start date
  • Tags Tags
    Error Format
Click For Summary

Discussion Overview

The discussion revolves around resolving compilation errors in Fortran code related to format strings, specifically the "Nonnegative width required in format string" and "Positive width required in format specifier D" errors. Participants explore potential solutions and related issues encountered during compilation.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant reports encountering errors related to format strings in Fortran code and seeks solutions.
  • Another participant suggests correcting the format specifiers from 1000i and 1000d to i4 and d4.2, respectively, to resolve the initial errors.
  • A participant confirms that the suggested changes eliminated the initial errors but led to a new fatal error regarding a missing module file 'dfport.mod'.
  • One participant recommends searching online for similar issues, providing a link to a Stack Overflow discussion.
  • A participant expresses frustration that previous searches did not yield functional solutions and specifies their use of the GNU Fortran compiler and Code::Blocks IDE.
  • Another suggestion is made to remove the use statements to identify what the compiler might be missing.
  • A participant reports that removing the use dfport statement resulted in a different error related to 'etime'.
  • One participant provides additional context about DFPORT being a library that adds Unix and VAX system routines.
  • A participant believes they have resolved their issue by disabling the USE DFORT statement.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to resolve the compilation issues, as multiple suggestions and experiences are shared without a definitive solution being established.

Contextual Notes

Some limitations include the dependency on specific compiler and IDE configurations, as well as unresolved issues related to missing module files and the implications of removing use statements.

MrElec
When compiling a fortran code (*.f90) i got these errors:

1- Nonnegative width required in format string.
2- Positive width required in format specifier D.

In Code::Blocks Ide, these errors are referred in the code to :

format( 1000i ) and format ( 1000d ) respectively.

How can i solve this?
 
Last edited by a moderator:
Technology news on Phys.org
Thanks, I've tried your solution and WoW these errors disapeared but unfortunately i got this message : D:\Simulations\CM\LAPACK_ARPACK\DOUBLE LAPACK\dsecnd.f|16| Fatal Error: Can't open module file 'dfport.mod' for reading at (1): No such file or directory|. Do you have an idea about this problem
 
THese questions are best answered by searching with Google to see if others have encountered them:

https://stackoverflow.com/questions/35015117/fatal-error-cant-open-module-file-dfport-mod-for-reading-at-1
 
  • Like
Likes   Reactions: MrElec
I've googled this problem before posting it here. In the link you gave, the authors could not give a functional solution. For my case, I'm using gnu fortron as compiler and C::B as an ide.
 
What about this from the link?

One suggestion is to remove the use statements, and see what the compiler/linker complains about being missing
 
I've tried to remove the use dfport statement, i got other error as etime
 
Thank you, i think that I've resolved my problem by switching off USE DFORT statement.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
5
Views
16K