Hello all
im a physics student and i am working on a simulation project so my doctor gave me an old fortran script for the simulation which he had written few years ago the problem is when i try to debug it,it shows error #6633: the type of the actual argument differs from the type of the dummy argument.[0]
several times this is one of them :
call moveto_w(0,0,wxy)
dummy=setcolor(9)
ekm=abs(phif(2,2))
do j=1,ngx
ekm=amax1(ekm,phif(1,j),phif(2,j),phif(3,j))
end do
call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy)
do j=1,ngx
dummy=lineto_w(j*500/ngx,phif(1,j)*100*.8/ekm)
end do
call moveto_w(500/ngx,phif(2,1)*100*.8/ekm,wxy)
do j=1,ngx
dummy=lineto_w(j*500/ngx,phif(2,j)*100*.8/ekm)
end do
and the declarations of this subroutine goes like this:
subroutine fieldf (ith)
**************************************************************************
include 'fgraph.fd'
common/param/ nsp,lx,ly,dx,dy,dt,nt
common/cfield/ ngx,ngy ,iw,rho0,g1(34,34),ex(34,34),ey(34,34)
$,bz(34,34)
common /xvp/ x(25602),y(25602),vx(25602),vy(25602)
common/cntrl/it,time,ithlx,ithly,iex,iey,ixvx,iyvy,
$ ivxvy,ifvx,ifvy
integer*2 dummy
record /wxycoord/ wxy
integer ith,l,ng2,hdx,hdy,ik,jk
real lx,ly,pi,erun1,erun2,kdx2,sm(34),ksq(34),eset,phif(34,34)
$,rhof(34,34),sc(34),rhok(34),lxlyi
data ng2,pi/0,3.128/
ps:im not very familiar with fortran coding and im using vs2012
>> now do i just create a file named "fgraph.fd" with this code in it and add it to the project's directory?
No, need for that. Like I said, the compiler can find it somewhere, possibly in its own installation directory.
This does make it possible to guess what is going on though. The structure "wxycoord" uses double precision reals, so my guess is that all coordinates are expected to be double precision. You will have to change your declarations from "real" to "double precision". And lines like:
call moveto_w(0,0,wxy)
call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy)
to (the "d0" indicates a double precision constant)
call moveto_w(0.0d0,0.0d0,wxy)
call moveto_w(500.0d0/ngx,phif(1,1)*100*.8d0/ekm,wxy)
to force the coordinates to double precision.
链接已复制
I would guess that the subroutine moveto_w and lineto_w are expecting floating point numbers.
For example:
subroutine moveto_w(x, y, wxy)
real x, y, wxy
and similar for lineto_w
The call moveto_w(0, 0, wxy) is passing integer zero actual values to the floating point dummy arguments x and y. Hence the mismatch.
If my guess is correct then you need to change 0 to 0.0
Also expressions such as 500/ngx are integer division. 500/1000 will give the result 0 not 0.5.
If a floating point value is expected then you need to change 500 to 500.0
Hope this helps
Les
thanks for responding
i tried 0.0 instead of 0 but the same error appear:error #6633: the type of the actual argument differs from the type of the dummy argument.[0.0]
and when trying x,y :error #6633: the type of the actual argument differs from the type of the dummy argument.[x]
error #6633: the type of the actual argument differs from the type of the dummy argument.
Instead of blindly trying different types of arguments to the routine moveto_w, consult the interface declaration to the routine in file ifqwin.f90, which is located in the compiler's include subdirectory, and make sure that the actual arguments are of the required type and kind.
To solve this, you will need to retrieve the interface definition of the routines. Apparently the compiler knows about them via an interface block or a module, or, it uses the first call to moveto_w and lineto_w to determine what other calls should look like. Chances are the include file "fgraph.fd" holds the secret.
That said, I do notice a few things in the code that you may want to look at more closely:
- You have 500/ngx in there. As these are two integers, the outcome is again an integer according to the rules in Fortran. That means no fraction. As long as ngx is smaller than 500, the result will be non-zero, but for instance 500/1000 is rounded to 0.
- Your calls mix integers and reals -
callmoveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy)for instance. The first argument is an integer (see first bullet0 and the second is a real - at th every least because of the factor .8 (again the rules that are used in Fortran)
This is going to upset the compiler as it wants the argument lists to be uniform in type (unless routine overloading is defined, but given the "age" of the code, I doubt that is the case).
arjenmarkus wrote:
To solve this, you will need to retrieve the interface definition of the routines. Apparently the compiler knows about them via an interface block or a module, or, it uses the first call to moveto_w and lineto_w to determine what other calls should look like. Chances are the include file "fgraph.fd" holds the secret.
That said, I do notice a few things in the code that you may want to look at more closely:
- You have 500/ngx in there. As these are two integers, the outcome is again an integer according to the rules in Fortran. That means no fraction. As long as ngx is smaller than 500, the result will be non-zero, but for instance 500/1000 is rounded to 0.
- Your calls mix integers and reals - call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy) for instance. The first argument is an integer (see first bullet0 and the second is a real - at th every least because of the factor .8 (again the rules that are used in Fortran)
This is going to upset the compiler as it wants the argument lists to be uniform in type (unless routine overloading is defined, but given the "age" of the code, I doubt that is the case).
as i mentioned i have no fortran experience but from what i understood the fgraph.fd is a missing file or subroutine ?!
No, it is a file on disk somewhere:
subroutine fieldf (ith) ************************************************************************** include 'fgraph.fd' common/param/ nsp,lx,ly,dx,dy,dt,nt
This is bound to contain some useful definitions. Its location is given by compiler options like -I<name of a directory>.
If the compiler were not able to find it, it would complain about that, so it is definitely somewhere around.
arjenmarkus wrote:
No, it is a file on disk somewhere:
subroutine fieldf (ith) ************************************************************************** include 'fgraph.fd' common/param/ nsp,lx,ly,dx,dy,dt,ntThis is bound to contain some useful definitions. Its location is given by compiler options like -I<name of a directory>.
If the compiler were not able to find it, it would complain about that, so it is definitely somewhere around.
well i dont see it i have only two files .for and .dat
but i've found somthing on the internet about fgraph.fd :
*fgraph.fd - declare constants and functions for graphics library
*
* Copyright (c) 1987-1989 Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file declares the graphics library functions and
* the manifest constants that are used with them.
*
*******************************************************************************
$NOTRUNCATE ! required for some names to be significant
$NOTSTRICT ! uses structures which are non-standard conforming
* user-visible declarations for FORTRAN Graphics Library
* structure for getvideoconfig() as visible to user
STRUCTURE/videoconfig/
INTEGER*2 numxpixels ! number of pixels on X axis
INTEGER*2 numypixels ! number of pixels on Y axis
INTEGER*2 numtextcols ! number of text columns available
INTEGER*2 numtextrows ! number of text rows available
INTEGER*2 numcolors ! number of actual colors
INTEGER*2 bitsperpixel ! number of bits per pixel
INTEGER*2 numvideopages ! number of available video pages
INTEGER*2 mode ! current video mode
INTEGER*2 adapter ! active display adapter
INTEGER*2 monitor ! active display monitor
INTEGER*2 memory ! adapter video memory in K bytes
END STRUCTURE
* return value of setlogorg(), etc.
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
* structure for text position
STRUCTURE/rccoord/
INTEGER*2 row
INTEGER*2 col
END STRUCTURE
* SETUP AND CONFIGURATION
* arguments to setvideomode()
INTEGER*2, $MAXRESMODE, $MAXCOLORMODE, $DEFAULTMODE,$TEXTBW40,
+ $TEXTC40,$TEXTBW80,$TEXTC80, $MRES4COLOR,$MRESNOCOLOR,
+ $HRESBW,$TEXTMONO,$HERCMONO, $MRES16COLOR,$HRES16COLOR,
+ $ERESNOCOLOR,$ERESCOLOR, $VRES2COLOR,$VRES16COLOR,
+ $MRES256COLOR,$ORESCOLOR
PARAMETER($MAXRESMODE =-3) ! graphics mode with highest resolution
PARAMETER($MAXCOLORMODE =-2) ! graphics mode with most colors
PARAMETER($DEFAULTMODE =-1) ! restore screen to original mode
PARAMETER($TEXTBW40 =0) ! 40 x 25 text, 16 grey
PARAMETER($TEXTC40 =1) ! 40 x 25 text, 16/8 color
PARAMETER($TEXTBW80 =2) ! 80 x 25 text, 16 grey
PARAMETER($TEXTC80 =3) ! 80 x 25 text, 16/8 color
PARAMETER($MRES4COLOR =4) ! 320 x 200, 4 color
PARAMETER($MRESNOCOLOR =5) ! 320 x 200, 4 grey
PARAMETER($HRESBW =6) ! 640 x 200, BW
PARAMETER($TEXTMONO =7) ! 80 x 25 text, BW
PARAMETER($HERCMONO =8) ! 720 x 348, BW for HGC
PARAMETER($MRES16COLOR =13) ! 320 x 200, 16 color
PARAMETER($HRES16COLOR =14) ! 640 x 200, 16 color
PARAMETER($ERESNOCOLOR =15) ! 640 x 350, BW
PARAMETER($ERESCOLOR =16) ! 640 x 350, 4 or 16 color
PARAMETER($VRES2COLOR =17) ! 640 x 480, BW
PARAMETER($VRES16COLOR =18) ! 640 x 480, 16 color
PARAMETER($MRES256COLOR =19) ! 320 x 200, 256 color
PARAMETER($ORESCOLOR =64) ! 640 x 400, 1 of 16 colors (Olivetti)
* videoconfig adapter values
* these manifest constants can be used to test adapter values for
* a particular adapter using the bitwise-AND operator
INTEGER*4 $MDPA,$CGA,$EGA,$MCGA,$VGA,$HGC,$OCGA,$OEGA,$OVGA
PARAMETER($MDPA =#0001) ! Monochrome Display Adapter (MDPA)
PARAMETER($CGA =#0002) ! Color Graphics Adapter (CGA)
PARAMETER($EGA =#0004) ! Enhanced Graphics Adapter (EGA)
PARAMETER($VGA =#0008) ! Video Graphics Array (VGA)
PARAMETER($MCGA =#0010) ! MultiColor Graphics Array (MCGA)
PARAMETER($HGC =#0020) ! Hercules Graphics Card (HGC)
PARAMETER($OCGA =#0042) ! Olivetti Color Graphics Adapter (OCGA)
PARAMETER($OEGA =#0044) ! Olivetti Enhanced Graphics Adapter (OEGA)
PARAMETER($OVGA =#0048) ! Olivetti Video Graphics Array (OVGA)
* videoconfig monitor values
* these manifest constants can be used to test monitor values for
* a particular monitor using the bitwise-AND operator
INTEGER*4 $MONO,$COLOR,$ENHCOLOR,$ANALOGMONO,$ANALOGCOLOR,$ANALOG
PARAMETER($MONO =#0001) ! Monochrome
PARAMETER($COLOR =#0002) ! Color (or Enhanced emulating color)
PARAMETER($ENHCOLOR =#0004) ! Enhanced Color
PARAMETER($ANALOGMONO =#0008) ! Analog Monochrome only
PARAMETER($ANALOGCOLOR=#0010) ! Analog Color only
PARAMETER($ANALOG =#0018) ! Analog
* COORDINATE SYSTEMS
* OUTPUT ROUTINES
* control parameters for Rectangle, Ellipse and Pie
INTEGER*2 $GBORDER,$GFILLINTERIOR,
+ $GCLEARSCREEN, $GVIEWPORT,$GWINDOW
PARAMETER($GBORDER =2) ! draw outline only
PARAMETER($GFILLINTERIOR =3) ! fill using current fill mask
PARAMETER($GCLEARSCREEN=0)
PARAMETER($GVIEWPORT =1)
PARAMETER($GWINDOW =2)
* TEXT
INTEGER*4 $GCURSOROFF,$GCURSORON,$GWRAPOFF,$GWRAPON
PARAMETER($GCURSOROFF=0)
PARAMETER($GCURSORON =1)
PARAMETER($GWRAPOFF =0)
PARAMETER($GWRAPON =1)
INTEGER*4 $GSCROLLUP, $GSCROLLDOWN
PARAMETER($GSCROLLUP =1)
PARAMETER($GSCROLLDOWN =-1)
C request maximum number of rows in _settextrows and _setvideomoderows
INTEGER*4 $MAXTEXTROWS
PARAMETER($MAXTEXTROWS =-1)
* "action verbs" for putimage()
INTEGER*4 $GPSET,$GPRESET,$GAND,$GOR,$GXOR
PARAMETER($GPSET =3)
PARAMETER($GPRESET =2)
PARAMETER($GAND =1)
PARAMETER($GOR =0)
PARAMETER($GXOR =4)
* universal color values:
INTEGER*4 $BLACK,$BLUE,$GREEN,$CYAN,$RED,$MAGENTA,$BROWN,
+ $WHITE,$GRAY, $LIGHTBLUE,$LIGHTGREEN,$LIGHTCYAN,
+ $LIGHTRED,$LIGHTMAGENTA, $LIGHTYELLOW,$BRIGHTWHITE
PARAMETER($BLACK =#000000)
PARAMETER($BLUE =#2a0000)
PARAMETER($GREEN =#002a00)
PARAMETER($CYAN =#2a2a00)
PARAMETER($RED =#00002a)
PARAMETER($MAGENTA =#2a002a)
PARAMETER($BROWN =#00152a)
PARAMETER($WHITE =#2a2a2a)
PARAMETER($GRAY =#151515)
PARAMETER($LIGHTBLUE =#3F1515)
PARAMETER($LIGHTGREEN =#153f15)
PARAMETER($LIGHTCYAN =#3f3f15)
PARAMETER($LIGHTRED =#15153f)
PARAMETER($LIGHTMAGENTA =#3f153f)
PARAMETER($LIGHTYELLOW =#153f3f)
PARAMETER($BRIGHTWHITE =#3f3f3f)
* mono mode F color values:
INTEGER*4 $MODEFOFF,$MODEFOFFTOON,$MODEFOFFTOHI,$MODEFONTOOFF,
+ $MODEFON,$MODEFONTOHI,$MODEFHITOOFF,$MODEFHITOON,
+ $MODEFHI
PARAMETER($MODEFOFF =0)
PARAMETER($MODEFOFFTOON =1)
PARAMETER($MODEFOFFTOHI =2)
PARAMETER($MODEFONTOOFF =3)
PARAMETER($MODEFON =4)
PARAMETER($MODEFONTOHI =5)
PARAMETER($MODEFHITOOFF =6)
PARAMETER($MODEFHITOON =7)
PARAMETER($MODEFHI =8)
* mono mode 7 color values:
INTEGER*4 $MODE7OFF,$MODE7ON,$MODE7HI
PARAMETER($MODE7OFF =0)
PARAMETER($MODE7ON =1)
PARAMETER($MODE7HI =2)
* external function declarations
INTEGER*2 setvideomode[EXTERN]
INTEGER*2 setvideomoderows[EXTERN]
INTEGER*2 setactivepage[EXTERN]
INTEGER*2 setvisualpage[EXTERN]
INTEGER*2 getactivepage[EXTERN]
INTEGER*2 getvisualpage[EXTERN]
EXTERNAL getvideoconfig
EXTERNAL setvieworg
EXTERNAL getviewcoord
EXTERNAL getphyscoord
EXTERNAL setcliprgn
EXTERNAL setviewport
EXTERNAL clearscreen
EXTERNAL moveto
EXTERNAL getcurrentposition
INTEGER*2 lineto[EXTERN]
INTEGER*2 rectangle[EXTERN]
INTEGER*2 ellipse[EXTERN]
INTEGER*2 arc[EXTERN]
INTEGER*2 pie[EXTERN]
INTEGER*2 setpixel[EXTERN]
INTEGER*2 getpixel[EXTERN]
INTEGER*2 floodfill[EXTERN]
INTEGER*2 setcolor[EXTERN]
INTEGER*2 getcolor[EXTERN]
EXTERNAL setlinestyle
INTEGER*2 getlinestyle[EXTERN]
EXTERNAL setfillmask
EXTERNAL getfillmask
INTEGER*4 setbkcolor[EXTERN]
INTEGER*4 getbkcolor[EXTERN]
INTEGER*4 remappalette[EXTERN]
INTEGER*2 remapallpalette[EXTERN]
INTEGER*2 selectpalette[EXTERN]
INTEGER*2 settextrows[EXTERN]
EXTERNAL settextwindow
EXTERNAL scrolltextwindow
EXTERNAL outtext
INTEGER*2 wrapon[EXTERN]
INTEGER*2 displaycursor[EXTERN]
INTEGER*2 settextcursor[EXTERN]
INTEGER*2 gettextcursor[EXTERN]
EXTERNAL settextposition
EXTERNAL gettextposition
INTEGER*2 settextcolor[EXTERN]
INTEGER*2 gettextcolor[EXTERN]
EXTERNAL getimage
EXTERNAL putimage
INTEGER*4 imagesize[EXTERN]
* WINDOW COORDINATE SYSTEM
* structure for window coordinate pair
STRUCTURE/wxycoord/
DOUBLE PRECISION wx ! window x coordinate
DOUBLE PRECISION wy ! window y coordinate
END STRUCTURE
INTEGER*2 setwindow[EXTERN]
EXTERNAL getwindowcoord
EXTERNAL getviewcoord_w
EXTERNAL getcurrentposition_w
* window coordinate entry points for graphics output routines
INTEGER*2 arc_w[EXTERN]
INTEGER*2 ellipse_w[EXTERN]
INTEGER*2 floodfill_w[EXTERN]
INTEGER*2 getpixel_w[EXTERN]
INTEGER*2 lineto_w[EXTERN]
EXTERNAL moveto_w
INTEGER*2 pie_w[EXTERN]
INTEGER*2 rectangle_w[EXTERN]
INTEGER*2 setpixel_w[EXTERN]
EXTERNAL getimage_w
INTEGER*2 imagesize_w[EXTERN]
EXTERNAL putimage_w
STRUCTURE/fontinfo/
INTEGER*2 type ! b0 set = vector,clear = bit map
INTEGER*2 ascent ! pix dist from top to baseline
INTEGER*2 pixwidth ! character width in pixels, 0=prop
INTEGER*2 pixheight ! character height in pixels
INTEGER*2 avgwidth ! average character width in pixels
CHARACTER*81 filename ! file name including path
CHARACTER*32 facename ! font name
END STRUCTURE
* Font parameters
INTEGER*2 $NO_SPACE, $FIXED_SPACE, $PROP_SPACE
PARAMETER ($NO_SPACE = 0)
PARAMETER ($FIXED_SPACE = 1)
PARAMETER ($PROP_SPACE = 2)
INTEGER*2 $NO_FONT_MAP, $VECTOR_MAP, $BIT_MAP
PARAMETER ($NO_FONT_MAP = 0)
PARAMETER ($VECTOR_MAP = 1)
PARAMETER ($BIT_MAP = 2)
INTEGER*2 registerfonts[EXTERN]
EXTERNAL unregisterfonts
INTEGER*2 setfont[EXTERN]
INTEGER*2 getfontinfo[EXTERN]
EXTERNAL outgtext
INTEGER*2 getgtextextent[EXTERN]
now do i just create a file named "fgraph.fd" with this code in it and add it to the project's directory?
>> now do i just create a file named "fgraph.fd" with this code in it and add it to the project's directory?
No, need for that. Like I said, the compiler can find it somewhere, possibly in its own installation directory.
This does make it possible to guess what is going on though. The structure "wxycoord" uses double precision reals, so my guess is that all coordinates are expected to be double precision. You will have to change your declarations from "real" to "double precision". And lines like:
call moveto_w(0,0,wxy)
call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy)
to (the "d0" indicates a double precision constant)
call moveto_w(0.0d0,0.0d0,wxy)
call moveto_w(500.0d0/ngx,phif(1,1)*100*.8d0/ekm,wxy)
to force the coordinates to double precision.
Right, the variables g1 (an array in a COMMON block) and gmax are single precision reals, so their product, g1(1,j)*gmax, is too. I suspect that you have a lot of routines that use these COMMON blocks, so the simplest solution is to leave these variables as they are and use the dble() function to convert the result to double precision. That is:
call moveto_w((j-1)*500.0d0/(ngx-1),g1(1,j)*gmax,wxy)
becomes:
call moveto_w((j-1)*500.0d0/(ngx-1), dble(g1(1,j)*gmax), wxy)
(Spaces added for clarity). You may have to do that in more than one location.
that worked too u r a fortran genius
but now im having trouble with too long statement:
call moveto_w((i-1)*100.0d0/(ngy-1),(i-1)*50.0d0/(ngy-1)+g1(i,1)*gmax,wxy)
i tried the continuation lines with "&"
it didn't work
The '&' character is used as a continuation character at the end of lines that are followed by continuation lines in free format source.
In fixed format source, which is what you are using, use a continuation character in column-6 of continuation lines.
mecej4 wrote:
The '&' character is used as a continuation character at the end of lines that are followed by continuation lines in free format source.
In fixed format source, which is what you are using, use a continuation character in column-6 of continuation lines.
the "$" worked thanx
I suspect that you are using "fixed form" sources. That means:
- The first six positions on a line are reserved and lines can be no longer than 72 characters.
- If you want to use long lines, they have to broken up using a non-zero, non-space character in the sixth position of the next line
Alternatively you can use the "long lines" option of the compiler.
In the source code breaking up a line is done like this:
*234567890 - just showing the positions on the line
call mysubroutine( with, a, very, long, list, of,
& arguments, so, that, I, need, to, break,
& it, up )
(I used to use an & because it is a character that meant nothing in Fortran)
Just a guess, but I think the structure is called WXYCOORD - at least that is what it is named in the file "fgraph.fd" you showed.
This is confusing - I found the file "fgraph.fd" in my installation of Intel. It actually uses the module ifqwin (so that the exact interfaces are known). The structure is indeed called XYCOORD and in the code you posted first I see "WXYCOORD".
So, from the file "fgraph.fd" (or rather "ifqwin.f90", which defines the module) I conclude it should indeed be "XYCOORD".
Is the error coming from the routine that include "fgraph.fd" or not? That makes a difference. At this point you will have to check the error messages and their relation to the code carefully - we can see only a small part (what you post) and have to guess what is going on.
it's not in the routine that contain the include fgraph.fd
but i solved it.
now i have 2 linking errors
desecription file
Error 1 error LNK2019: unresolved external symbol SETTEXTPOSITION referenced in function MAIN__ EM2DB.obj
Error 2 fatal error LNK1120: 1 unresolved externals EM2DB.exe
The (nonstandard) graphics interfaces have been adopted and adapted since the days of Microsoft Fortran (16-bit). Older versions tend to use 16-bit integer arguments, and later versions use 32-bit integer arguments. You should be very careful that you do not give the compiler incorrect interfaces, which is what could happen if you retrieve a seemingly compatible fgraph.fd from some internet site. Using an incorrect interface could change compile time errors into run-time errors, which are more harmful as well as more difficult to isolate and fix.
All the interfaces are available in files provided with your Intel Fortran installation. Do not corrupt your installation with files from other sources or files from an older version of the compiler. Remember the Zeroth Law of Computing: "Don't make a mess!".