【发布时间】:2018-08-14 02:46:30
【问题描述】:
我正在尝试将 MinGW 的 fortran (G95) 设置为在 Sublime Text 3 中工作。 我查看了How do you configure MinGW with Sublime Text 3? 和Could someone help me configure MinGW in SublimeText 3? (Newbie) 我发现了这个:
{
"cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["start", "cmd", "/k", "${file_path}/${file_base_name}.exe"],
"shell": true
}
]
}
所以我创建了文件 packages/user/fortran(G95).sublime-build。那里我不知道在 ${file_path} 或 ${file_base_name} 变量中写什么,所以我尝试了这个:
{
"cmd": ["gcc", "C:/MinGW/bin", "-o", "g95.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "C:/MinGW/bin",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["start", "cmd", "/k", "C:/MinGW/bin/g95.exe"],
"shell": true
}
]
}
但它会返回:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: 找不到 C:/MinGW/bin: Permission denied collect2.exe: error: ld 返回 1 个退出状态 [Finished in 0.3s]。
我做得对还是在创建文件时搞砸了。
非常感谢您为完成这项工作提供的任何建议和帮助。
PS:我已经在 PATH C:/MinGW/bin 和 C:/MinGW/mingw32/bin 中了。我使用的是 64 位的 Windows 10。
编辑: 现在我确实将文件改回了这个:
{
"cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["start", "cmd", "/k", "${file_path}/${file_base_name}.exe"],
"shell": true
}
]
}
但它说它不知道我的 Hello world 程序中的 write 函数等等。
C:\Users\TPN~1\AppData\Local\Temp\ccV3Loja.o:helloworld.f90:(.text+0x3b): 对
_gfortran_st_write' C:\Users\TPN~1\AppData\Local\Temp\ccV3Loja.o:helloworld.f90:(.text+0x59): undefined reference to_gfortran_transfer_character_write' 的未定义引用 C:\Users\TPN~1\AppData\Local\Temp\ccV3Loja.o:helloworld.f90:(.text+0x67): 对_gfortran_st_write_done' C:\Users\TPN~1\AppData\Local\Temp\ccV3Loja.o:helloworld.f90:(.text+0x8a): undefined reference to_gfortran_set_args' 的未定义引用 C:\Users\TPN~1\AppData\Local\Temp\ccV3Loja.o:helloworld.f90:(.text+0x9e): 未定义对“_gfortran_set_options”collect2.exe 的引用:错误:ld 返回 1 个退出状态 [1.0s 完成]
【问题讨论】:
标签: fortran windows-10 mingw sublimetext3