- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
character*(FileNameLength) cFileName
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you are including several header files some of which may declare the same common block but with different/different allocations of variables?
Also your given declaration for cFileName is not in a COMMON.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is that I have FileNameLength defined in a common block AND in the program.
The program has
include 'fnames.gcb'
integer,parameter:: FileNameLength=250
character*(FileNameLength) cFileName
etc...
The common block is in file 'Fnames.gcb'
integer,parameter:: FileNameLength=250
character*(FileNameLength) cgbf,CCOD
common/fnames/ cgbf,CCOD
The error message is:
This name has already been assigned a data type. [FILENAMELENGTH]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FileNameLength isn't a variable - you have declared it as a PARAMETER value and are attempting to assign a value to it twice.
Also make sure you aren't mixing up 250 and 255 for your name lengths
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to use the variable 'FileNameLength' in several Common blocks.
I have tried removing them, to leave only one, but get the error messages:
'A COMMON block data object must not be an automatic object.'
and
'This name has not been given an explicit type. [FILENAMELENGTH]'
I'm getting confused,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure if I follow you.
I have made a new common block called fnl.gcb:
integer:: FileNameLength=250
common/FNL/FileNameLength
It wouldn't compile with 'Parameter'.
Then in each program that needs this variable or has an include file that needs this variable I have added include 'fnl.gcb'.
When I compile, I get an error on the first program which containsa common block.
Error: A COMMON block data object must not be an automatic object.
I don't know what that error messagemeans.
I don't think I have any spelling problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your original problem was that you defined FileNameLength twice, once in .gcb file and other time again in code (.for file) (that's what I meant by "spelled"). The solution was just to remove the re-declarations.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David,
If you can, why not dispense with COMMON. You can do this by creating a module containing the arrays, variables and constant parameters. I've done this on a Solution with 11 project files and ~700 source modules. It is a bit of work but you can do it incrimentaly. You could start with
-----------------------------
character*(FileNameLength) cFileName
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
! file name length
integer,parameter:: FileNameLength=250
end module
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oops us
#define Array bing.Array
#define Array1 bing.Array1
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page