Author Topic: Formatting in Fortran - Code::Blocks  (Read 3815 times)

Offline chaitu49

  • Single posting newcomer
  • *
  • Posts: 2
Formatting in Fortran - Code::Blocks
« on: April 07, 2016, 10:46:23 pm »
I am trying to convert an old code into GFortran using code blocks. I am running into a formatting issue. I would be grateful if anyone can help...

I have the following code:

implicit double precision (a-h,o-z)
         n = 7
         ns = 2

        dim = 2*n+3+ns

         write(*,21) !a bunch of variables to write !

 21    format(dim(e14.9e3))

I have the following errors:
"Positive width required in format specifier D"
"Format label 21 not defined"

Thanks in advance!

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Formatting in Fortran - Code::Blocks
« Reply #1 on: April 10, 2016, 11:36:11 pm »
1) Hi and welcome to the forum
2) Use code tags if you post code or build logs (Use the # symbol in the new topic editor)
3) This is a forum about codeblocks the ide and not fortran the compiler, so you are here in the wrong place to ask this king of questions: http://forums.codeblocks.org/index.php/topic,9996.0.html
and: http://wiki.codeblocks.org/index.php/FAQ-General#Q:_What_Code::Blocks_is_not.3F
4) I have no idea about fortran code but i think this can help you:
http://stackoverflow.com/questions/29982687/positive-width-error
https://www.physicsforums.com/threads/fortran-error-in-formatted.752215/
http://stackoverflow.com/questions/11037954/error-nonnegative-width-required-in-format-string-at-1

greetings

Offline chaitu49

  • Single posting newcomer
  • *
  • Posts: 2
Re: Formatting in Fortran - Code::Blocks
« Reply #2 on: April 11, 2016, 02:15:38 am »
Thank you for the help! The suggestion in the websites you sent indeed worked!