作者perturb (背後有老板)
看板Fortran
标题Re: 看不懂的error
时间Sat Feb 12 09:49:25 2011
这是link出问题了
最简单粗暴的方法就是不管这些信息
第二个错误是找不到main program
也就是你所有文件中没有一个是包含program xx... end 的
第一个错误说明function length is undefined when invoked
按照你的叙述可以推测你用的是multi source files而在link的时候object顺序错误
On Unix-like systems, the traditional behavior of compilers and linkers
is to search for external functions from left to right in the object files
specified on the command line. This means that the object file which
contains the definition of a function should appear after any files which
call that function.
比如filea有length的definition 而fileb中invoke了length函数
link的时候用$LINKER filea.o fileb.o 可能出现第一个错误而
$LINKER fileb.o filea.o 就没问题
※ 引述《pipidog (如果狗狗飞上天)》之铭言:
: error message:
: C:\Users\pipidog\AppData\Local\Temp/cc1SGLik.o:dBJ_generator2.f90:(.data+0x0):
: undefined reference to `_d_function_length__'
: c:/program
: files/g95/bin/../lib/gcc-lib/i686-pc-mingw32/4.0.4//libf95.a(main.o):(.text+0x32):
: undefined reference to `_MAIN_'
: ======
: 应该不能说是error,因为是可以complie的,但是会有warning,这种
: undefined reference to xxx 的warning到底是什麽意思呢?
: *d_function_length是一个自定函数,至於MAIN不知是啥~~
: 请教有经验的人回答了...弄了很久一直无法去掉这些讯息
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 162.105.195.208
1F:→ pipidog:感谢,这真是一个清楚的回答,获益良多 02/12 11:13