精華區beta Fortran 關於我們 聯絡資訊
這是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
pipidog:感謝,這真是一個清楚的回答,獲益良多 02/12 11:13