Error 6404 when running fortran code in visual studio

Click For Summary

Discussion Overview

The discussion revolves around an error encountered when compiling FORTRAN code in Visual Studio, specifically related to the use of the intrinsic subroutine getcwd. Participants explore potential causes and solutions for the error message received during compilation.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses uncertainty about the error and seeks assistance, noting their lack of experience with FORTRAN.
  • Another participant suggests that the return type of the getcwd function may need to be defined, referencing documentation that indicates getcwd can be used as either a procedure or a function.
  • A participant clarifies that getcwd is an intrinsic subroutine and should be called as a subroutine rather than a function that returns a value.
  • It is noted that the documentation for getcwd indicates it can return a status, but the invocation style must be chosen correctly.
  • One participant shares their successful experience with a short program, questioning whether the issue might be related to the specific compiler being used.
  • Another participant suggests trying the subroutine style call for getcwd and mentions the possibility of the compiler misinterpreting the call.
  • A participant mentions finding a source that prototypes getcwd, suggesting that this might be necessary due to its dual invocation styles and recommends ensuring the status variable is appropriately typed.
  • A participant acknowledges the suggestions and indicates they will try them, mentioning they are using Visual Studio with Intel Fortran Compiler (IVF).

Areas of Agreement / Disagreement

Participants present multiple competing views on how to correctly invoke getcwd and address the error, with no consensus reached on a single solution.

Contextual Notes

There are unresolved aspects regarding the specific compiler behavior and the implications of using getcwd in different invocation styles. The discussion also reflects varying levels of familiarity with FORTRAN among participants.

Who May Find This Useful

Individuals working with FORTRAN in Visual Studio, particularly those encountering similar compilation errors or seeking clarification on the use of intrinsic subroutines.

snow.ball
Messages
2
Reaction score
0
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
 
Technology news on Phys.org
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:
getcwd(DirName)
 
The docs for getcwd() indicate that it can return a status but that you have to decide which style of invocation to use.
 
jedishrfu said:
The docs for getcwd() indicate that it can return a status but that you have to decide which style of invocation to use.
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.
 
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) ".
 
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.
 
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...
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 8 ·
Replies
8
Views
2K