看板 Fortran 關於我們 聯絡資訊
大家好 我有個教授給的fortran程式 看了精華區後 我安裝了mingw-get-inst 這個檔案 然後想要去執行我的fortran程式 可是... 請問我要怎麼執行? 我非常的新手 在GOOGLE大量網頁之前 我以為fortran跟c那些一樣 有個介面可以讓我輸入程式碼 然後我按run 他就會執行 後來發現fortran似乎要利用terminal來輸入指令 這就難倒我了... 請問有大大可以教我 如何操作嗎 ps:原本我是想使用mac來執行 然後安裝了gfortran 按照他的指示 在terminal裡輸入 gfortran 檔名.f 他就會開始執行了 他的確也跑了 不過他跑一跑出錯了 我也不知道該怎麼辦 所以就跳來windows用 有mac的經驗 我想說 xp 這邊是不是也要到 命令提示字元 裡 輸入 mingw 檔名.f 這樣讓他跑 不過是不是也要把我所有的程式碼 丟到某個特定 的資料夾 他才能讀取到 我想要執行的程式裡 有一堆subroutine 他的程式碼 我基本上都看懂他在寫什麼了 可是卻還不會執行 冏rz 請高手幫幫我 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.27.170.174
terryys:mingw是編譯器,你說的輸入程式碼界面是ide,fortran ide 08/15 10:51
terryys:比較少,我用過幾個覺得code::blocks衍生的那個不錯 08/15 10:52
terryys:不過你只是要編譯程式的話就是gfortran filename.f就可以 08/15 10:53
terryys:但是環境變數要設好,mingw說明應該有 08/15 10:54
terryys:然後你說的錯誤看起來是編譯時候發生的,可以Po上來讓大家 08/15 10:55
terryys:幫忙看看 08/15 10:55
blc:不用ide的話,一般都是寫完程式存檔 (例如 prog.f),然後編譯 08/15 19:59
blc:(例如 gfortran prog.f),成功的話會出現執行檔( a.out ), 08/15 20:00
blc:就可以run程式了 (例如 ./a.out )。 08/15 20:01
http://tinyurl.com/3js5mck 請問兩位 我按照這個網站的說明在termainal 依序打了 cd ~ ls -al 然後因為沒有.bash_profile這個檔案 所以我也新建了這個檔 然後在這個檔裡貼上了 PATH=/usr/local/bin:$PATH 之後就在iMac的資料夾 新建一個叫做gfortranwhamp的資料夾 把所有我要執行的 xxxxx.f 丟到裡面 然後在terminal 打cd gfortranwhamp 到 gfortranwhamp 這資料夾 接著輸入gfortran whamp.f (whamp.f是 program whamp的檔案 其他檔案 都是subroutine) 然後就出現了 comin.h:8.21: Included at whamp.f:193: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start ld warning: duplicate dylib /usr/local/lib/libgcc_s.1.dylib Undefined symbols: "_outpt_", referenced from: _MAIN__ in ccOYGzgG.o _MAIN__ in ccOYGzgG.o "_typin_", referenced from: _MAIN__ in ccOYGzgG.o "_difu_", referenced from: _MAIN__ in ccOYGzgG.o _MAIN__ in ccOYGzgG.o _MAIN__ in ccOYGzgG.o "_read_input_file_", referenced from: _MAIN__ in ccOYGzgG.o ld: symbol(s) not found collect2: ld returned 1 exit status 請問兩位 我是在哪個地方出錯呢 @@?? outpt typin difu read_input_file 這些都是我的subroutine ※ 編輯: chise 來自: 114.47.210.141 (08/15 23:12) ※ 編輯: chise 來自: 114.47.210.141 (08/16 00:17)
blc:gfortran whamp.f others.f moreone.f 08/16 09:52
我按照b大的方法 把所有會用到的全部輸入了 結果... comin.h:8.21: Included at whamp.f:193: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start wrfi.f:24.51: SBU(IB)=GBU(IB)/SQRT(VG(1)**2+VG(2)**2+1.E-66) Warning: Real constant underflows its kind at (1) comin.h:8.21: Included at wrfi.f:6: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start comin.h:8.21: Included at output.f:6: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start comin.h:8.21: Included at difu.f:10: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start comin.h:8.21: Included at xsi.f:15: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start comin.h:8.21: Included at av.f:23: COMMON /PLASMA/JMA,BVEC(3),DBVDR(3,4),DBDR(4), Warning: COMMON 'plasma' at (1) requires 4 bytes of padding at start ld warning: duplicate dylib /usr/local/lib/libgcc_s.1.dylib 請問 這問題是出在哪裡@@ 是我的gfortran版本跟program不合? 還是其他的問題? 這program是用fixed format寫的 所以我的gfortran讀得時候出錯? ※ 編輯: chise 來自: 114.40.207.64 (08/16 17:49) ※ 編輯: chise 來自: 114.40.207.64 (08/16 17:53)
terryys:都是warning的話還是可以編譯 多數都是有關common block, 08/16 20:15
terryys:這不一定會有問題 有一個1.e-66超出sp的範圍了,這需要dp 08/16 20:17
terryys:最後那個是說有重複的dylib,可能你的設置有點問題 08/16 20:18
我試著去解決這一行的問題 duplicate dylib /usr/local/lib/libgcc_s.1.dylib 我到terminal打了 cd /usr/local/lib 然後打 ls -al 查看所有裡面的檔案 發現裡面有非常多的檔案 我google後 有人建議說 要是/usr/local裡沒有其他東西 就整個刪掉 不過我怕刪掉不該刪掉的東西 所以 我想要刪掉libgcc_s.1.dylib這個檔案 我就打rm libgcc_s.1.dylib terminal顯示 override rw-r--r-- 502/502 for libgcc_s.1.dylib? 我按 y 他出現rm: libgcc_s.1.dylib: Permission denied 不讓我刪除 我看了/usr/local/lib裡的檔案 檔案擁有者 和 檔案所屬群組 不是502 就是 root 這... 502 是誰啊 @@ 後來我找了一個指令 把所有user是502的 改成我的名字imac 可是依然不能刪除>< ※ 編輯: chise 來自: 114.40.207.64 (08/16 22:39) ※ 編輯: chise 來自: 114.40.207.64 (08/16 22:50) ※ 編輯: chise 來自: 114.40.207.64 (08/16 23:26)
terryys:google gfortran dylib duplicate似乎是安裝或版本問題 08/17 00:34
terryys:然後也不應該嘗試把那個刪除 08/17 00:35
我google了好久 想要解決duplicate dylib /usr/local/lib/libgcc_s.1.dylib 似乎沒有找到解決方法 rm 或 mv 也都是 permission denied http://blog.chinaunix.net/space.php?uid=20145706&do=blog&cuid=1877638 我是聽從這網頁 #20 的建議才去做 移動或是刪除那個檔案 ※ 編輯: chise 來自: 114.40.207.64 (08/17 04:04)
terryys:你試過用sudo改名字嗎?不建議移除是因為你以後需要這個檔 08/17 12:30
terryys:案的話就很可能需要重新安裝 08/17 12:30