Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gFortran Compiler error with Code::Blocks IDE

Status
Not open for further replies.

mtamimi

Technical User
Dec 27, 2012
9
US
Hi
I started to use Code::Block IDE to write and compile my fortran code recently. I was able to successfully compile and run a code and obtained results.
This past week end I had to remove some programs on my laptop because it was getting full. When I came back to my code and recompile it I got the following errors:

For the following fortran statement :
Code:
Stamp = CTIME(TIME())

The error message:
“Error: Function 'time' has no IMPLICIT type”

For the following fortran statement :
Code:
Call SYSTEM(sCommand, Status=iResult)
The error message:
D:\MSDEV\Projects\Pixel8\X-BeamSimulation\Pixel8SnglBeamSimMC\main.f90|2258|D:\MSDEV\Projects\Pixel8\X-BeamSimulation\Pixel8SnglBeamSimMC\main.f90 2258 .35:|
“Error: Keyword argument requires explicit interface for procedure 'system' ”

Note: that the 2258 point to the line number in the code where this statement appear and 35 points to the character number where the error start in this case iResult.

Keep in mind that this code compiled and ran correctly before. I checked the environment variable and made sure I point correctly to the \include & \lib folder. Any ideas????
What did I do wrong???
 
Hhmmm, that is strange.

If your code worked before you cleaned up and now it does not, then I would assume you deleted some important things.
But this should result in a few more errormessages of your compiler about includefiles or modules not found.

As to your errors:
I do not know about gfortran, but in my environment TIME() comes in two flavors. One is the fortran intrinsic funtion, you call it like
Code:
character*8 cTime
...
...
call Time (cTime)

The other is a portability function (whatever this is, I have no idea) and this seems to be the one you are using as CTIME needs an integer-type argument

Code:
use DFPORT                ! this is the module containing declarations telling the compiler that time() is not the intrinsic. 
integer iTime
...
...
iTime = Time ()           ! I just made two statements of it for clarification
Stamp = cTime (iTime)

Seems to be somewhat similar in gFortran, as your code seems to invoke the intrinsic function, which would not be called the proper way.

The other one is similar. Your compiler does not recognise your call to the system-function and lacks some knowledge on what to do. The interface your compiler requires would be in the same module or includefile your compiler apparently did not find.

That's my two cents worth. Maybe this helps some.

Norbert


The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Hi
Thanks very much for the input. I use the CTime() throughout the code to time sections executions and the compiler also report them as error. I also use the following function to get a random number
Code:
Call random_number(Constant)
and that also return as error. That is why I thought I might have broken a link or a location pointer since they all point back at intrensic gfortran routines. (FPS has similar routines). So I tried to point to the include or lib folder location in the Code::Block compiler setting interface.
I tried to get help from the Code::Block developers. Their initial response that is a compiler problem. I wrote them back for guidance regarding this problem & still waiting. I still think the project setting changed and I can not put my finger on what changed.
Code::Block was easier to use and setup than net bean & Eclipse that why I decided on using it. gFortran & gdb worked fine and the resultant exe was excellent and thought it was fast. I hope I can get a solution to finish my program.
I well keep you guys posted.


Mat
mtamimi@netzero.net
 
Mat:

Make a note of this and write it down in your lessons-learned notebook...I am talking about what might have happened that has nothing to do with Fortran

Get smarter about managing your computer
Take smaller steps
Take steps that are initially reversible
Be smarter about deleting files
Start by deleting stupid photos and videos, not system or application files.
Don't delete outright, start by simply compressing
Then, if nothing breaks, unload the compressed file to a peripheral device...just in case.
If you think you messed up an installation, don't expect the developers magically solve your problem
The least you can do is "pay for your mistake" and re-install the software (may not bring the settings back, but it will bring necessary files)
etc., etc., you get the gist.

Good luck


 
It looks like the compiler/codeblocks has lost some settings. Try running gfortran from the command line. Something simple like
Code:
program main
   print *, 'gfortran is working'
   stop
end program main
If that works, then try adding time
Code:
program main
   ! do you need some interface declarations for ctime or time here
   ! in a using statement of some sort?
   print *, 'gfortran is working ', ctime(time())
   stop
end program main
If that works, then you know it is a codeblocks problem. If it doesn't then it is a gfortran problem. Initially try uninstalling and reinstalling the compiler/ide. See how far that goes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top