Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Error 6404 when running fortran code in visual studio

  1. Nov 18, 2014 #1
    I am trying to compile several libraries of FORTRAN code and getting the error message as can be seen in the screen shot. As I do not have any experience with FORTRAN I am not sure what is wrong in the line highlighted line. Any help would be greatly appreciated! Thanks a lot!!! :-)
    upload_2014-11-18_13-11-7.png
     
  2. jcsd
  3. Nov 18, 2014 #2

    jedishrfu

    Staff: Mentor

    Do you need to include something that defines the return type of the get_cwd function?

    Also the description of get_cwd says you can either use it as a procedure or as a function but not both but I'm not sure that is your problem.

    https://gcc.gnu.org/onlinedocs/gfortran/GETCWD.html
     
  4. Nov 18, 2014 #3

    Mark44

    Staff: Mentor

    getcwd (get current working directory) is an intrinsic subroutine, but you have invoked it as if it were a function that returns a value. This is how it should be called:
    Code (Text):
    getcwd(DirName)
     
  5. Nov 18, 2014 #4

    jedishrfu

    Staff: Mentor

    The docs for getcwd() indicate that it can return a status but that you have to decide which style of invocation to use.
     
  6. Nov 18, 2014 #5

    Mark44

    Staff: Mentor

    Aha! I saw the example on a doc page and didn't notice that getcwd could also be used as a function. Thanks for the correction.
     
  7. Nov 18, 2014 #6
    hhhmmm...just tried a short program and it worked just fine.

    Which compiler are you using? Maybe your compiler does not quite like that call?

    Maybe your compiler thinks that what you have is some kind of array, instead of a function call.


    I would switch and try the "subroutine" style call instead: " call GETCWD(DirName, Status) ".
     
  8. Nov 18, 2014 #7
    just found a source where they prototype getcwd even though is an intrinsic...maybe due to the fact that can be called either way?

    Go ahead and prototype it at the beginning of the subroutine: "integer*4 :: getcwd" ...you should probably also make sure that status is of the same type or larger.
     
  9. Nov 20, 2014 #8
    hey guys. sorry just replying now and thank's so much for the suggestions! I will try them all out! btw using visual studio with IVF...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Error 6404 when running fortran code in visual studio
Loading...