主题:没法连接,提示说total image exceeds不懂各位给看看怎么回事?
拜月贪狼
[专家分:20] 发布于 2010-11-30 15:54:00
c子函数
real function displacement(x)
real pi
integer x
pi=3.1415926
if((x.ge.0).and.(x.le. 100))then
displacement=(1.0e-03)*sin((pi/100)*x)
else
displacement=0
endif
end
c主函数
program main
parameter(pi=3.1415926,e=1,rou=1,l=1.0)
real dx,c,t,area
real k(2,2),m(12),u(-1:200,0:12)
real t11,t12,t13,ss
integer i,j
dx=0.01
c=sqrt(e/rou)
dt=0.001
area=1
gxs=(e*area)/dx
zxs=(rou*area*dx)/2
k(1,1)=gxs
k(1,2)=(-1)*gxs
k(2,1)=(-1)*gxs
k(2,2)=gxs
do i=1,11
m(i)=(dt*dt)/(zxs*2)
enddo
m(1)=(dt*dt)/zxs
ss=(c*dt)/dx
t11=(2-ss)*(1-ss)/2
t12=ss*(2-ss)
t13=ss*(ss-1)/2
do i=1,12
u(-1,i)=0
u(0,i)=0
enddo
do j=0,199
u(j,1)=displacement(j)
do i=2,11
u(j+1,i)=2*u(j,i)-m(i)*(k(i,3)*u(j,i-1)+k(i,4)*u(j,i)+
&k(i,1)*u(j,i)+k(i,2)*u(j,i+1))-u(j-1,i)
enddo
u(j+1,12)=t11*u(j,12)+t12*u(j,11)+t13*u(j,10)
enddo
open(11,file='result.txt',status='unknown')
do j=0,200
write(11,*) j*dt,u(j,1),u(j,5),u(j,11)
enddo
end
回复列表 (共5个回复)
沙发
拜月贪狼 [专家分:20] 发布于 2010-11-30 16:11:00
程序修改
c子函数
real function displacement(x)
real pi
integer x
pi=3.1415926
if((x.ge.0).and.(x.le. 100))then
displacement=(1.0e-03)*sin((pi/100)*x)
else
displacement=0
endif
end
c主函数
program main
parameter(pi=3.1415926,e=1,rou=1,l=1.0)
real dx,c,t,area
real k(2,2),m(12),u(-1:200,0:12)
real t11,t12,t13,ss
integer i,j
dx=0.01
c=sqrt(e/rou)
dt=0.001
area=1
gxs=(e*area)/dx
zxs=(rou*area*dx)/2
k(1,1)=gxs
k(1,2)=(-1)*gxs
k(2,1)=(-1)*gxs
k(2,2)=gxs
do i=1,11
m(i)=(dt*dt)/(zxs*2)
enddo
m(1)=(dt*dt)/zxs
ss=(c*dt)/dx
t11=(2-ss)*(1-ss)/2
t12=ss*(2-ss)
t13=ss*(ss-1)/2
do i=1,12
u(-1,i)=0
u(0,i)=0
enddo
do j=0,199
u(j,1)=displacement(j)
do i=2,11
u(j+1,i)=2*u(j,i)-m(i)*(k(2,1)*u(j,i-1)+k(2,2)*u(j,i)+
&k(1,1)*u(j,i)+k(1,2)*u(j,i+1))-u(j-1,i)
enddo
u(j+1,12)=t11*u(j,12)+t12*u(j,11)+t13*u(j,10)
enddo
open(11,file='result.txt',status='unknown')
do j=0,200
write(11,*) j*dt,u(j,1),u(j,5),u(j,11)
enddo
end
板凳
拜月贪狼 [专家分:20] 发布于 2010-11-30 16:13:00
前面的程序有地方数组越界。能算出结果,但是仍然提示。image may not run
3 楼
baccle [专家分:190] 发布于 2010-12-01 21:29:00
把运行时提示的错误完整的发上来
4 楼
拜月贪狼 [专家分:20] 发布于 2010-12-01 23:00:00
Debug/mainprogram.exe : warning LNK4084: total image size 538533888 exceeds max (268435456); image may not run
mainprogram.exe - 0 error(s), 1 warning(s)
5 楼
臭石头雪球 [专家分:23030] 发布于 2010-12-05 20:29:00
造成这个警告的原因多半是因为静态数组太大。改成 allocatable 以后就可以解决。
这个问题是提示你,编译后的EXE镜像太大,有些操作系统可能无法加载这么大的EXE镜像。
由于多数编译器把静态数组放在 DATA 段,然后映射到内存。所以可能造成EXE偏大。建议修改为可分配数组。
[quote]Q1019 - Linker warning: "LNK4084 - total image size exceeds max (268435456); image may not run"
Platforms: All
Versions: All
Fixed in version: N/A
Article created: 08 June 1998
Article revised: 16 September 2002
Description: When linking an application which contains large arrays, the linker gives the warning "LNK4084 - total image size exceeds max (268435456); image may not run".
Explanation: Windows 95 and Windows NT 4.0 have a limit for the total size of static code and data of 256MB. If the amount of static code and data exceeds this size, the image may not execute. This is a limitation in the operating system and not in Visual Fortran or its tools. The most common cause of large static data is large local or COMMON arrays. The linker issues an informational warning in this case to alert you of the potential problem.
However, if the actual image size is displayed as a negative value, that means that the image size exceeds 2GB and your program will not run on any version of 32-bit Windows.
Solution: For Windows NT 4.0, install Microsoft's Windows NT Service Pack 3 (or later). This raises the limit on static code and data to 1.75GB. However, the linker is not modified by this update and will continue to issue the warning, which can be ignored. The limit on Windows 98, Windows 2000 and Windows XP is 1.75GB, the same as Windows NT 4.0 with Service Pack 3 - if your application will be not be running on Windows 95, or on Windows NT 4.0 prior to SP3, and the actual image size is not displayed as a negative value, you can ignore this message.
For Windows 95, Microsoft has not released an update which raises the limit.
If you wish to prevent the message from being issued when you link, select Project..Settings..Link. At the end of the Project Options box, type in:
/ignore:4084
An alternative is to make the large arrays ALLOCATABLE. Dynamically allocated data is not subject to the 256MB limit.
Example #1: Local array
Old:
REAL BIG_ARRAY(1000,1000,500) !500MB
New:
REAL,ALLOCATABLE :: BIG_ARRAY(:,:,
...
ALLOCATE (BIG_ARRAY(1000,1000,500))
! ALLOCATE statement goes in executable
! part of program
Example #2: Common array
Old:
! Include file declaring COMMON array
REAL BIG_ARRAY(1000,1000,500) !500MB
New:
! New source file containing MODULE as follows
MODULE BIG_STUFF
REAL,ALLOCATABLE::BIG_ARRAY(:,:,
END MODULE BIG_STUFF
! Add to routines using BIG_ARRAY
USE BIG_STUFF
! Add to main program
USE BIG_STUFF
...
ALLOCATE (BIG_ARRAY(1000,1000,500)
Note that USE statements must immediately follow PROGRAM, SUBROUTINE or FUNCTION statements. For more information on MODULE, USE and ALLOCATABLE arrays, see the Language Reference Manual.[/quote]
我来回复