VsCode Fortran Settings
Modern Fortran [Miguel Carvajal]
Fortran highlight plugin.
C/C++ for Visual Studio Code [Microsoft]
C/C++ debug plugin also supports fortran.
Toggle debug and modify the example and
files.
Makefile Tools [Microsoft, optional]
You can set make
command in or use this plugin to compile make project.
// vscode settings
{
"": [
{
"cwd": "/home/user/project",
"binaryPath": "/home/user/project/bin/program",
"binaryArgs": []
}
]
}
Here is a example for C/C++ make project.
Directory tree
- bin
-- main
- src
--
--
--
- Makefile
Makefile
LINK = @echo linking $@ && g++
GCC = @echo compiling $@ && g++
GC = @echo compiling $@ && gcc
AR = @echo generating static library $@ && ar crv
FLAGS = -g -DDEBUG -W -Wall -fPIC
GCCFLAGS =
DEFINES =
HEADER = -I./
LIBS =
LINKFLAGS =
BIN_PATH = bin
SRC = $(wildcard src/*.cpp)
INCLUDES = include
TARGET = main
OBJECT = $(SRC:%.cpp=%.o)
.SUFFIXES: .cpp .c
.:
$(GCC) -c $(HEADER) $(FLAGS) $(GCCFLAGS) -fpermissive -o $@ $<
.:
$(GC) -c $(HEADER) $(FLAGS) -fpermissive -o $@ $<
$(TARGET) : $(OBJECT)
@echo "============开始编译============"
$(LINK) $(FLAGS) $(LINKFLAGS) -o $@ $^ $(LIBS)
mv $(TARGET) $(BIN_PATH)
@echo "============编译结束============"
clean:
rm -rf $(OBJECT) $(TARGET)
FORTRAN IntelliSense (Chris Hansen
)
Install fortran-language-server and create .fortls
file if you need to modify the default configuration.
pip install fortran-language-server
An example of .fortls
to add external source of hdf5 libs.
{
"ext_source_dirs": ["/home/user/hdf5/fortran/src"],
"debug_log": true
}
fprettify (Blamsoft
)
Fortran code formatter.
pip install --upgrade fprettify
Integrating with VsCode, modify in your need:
// VsCode settings
{
"": "-i 4 --case 1 1 1 2"
}
作者:PorYoung
原文地址:/?p=1190
发布时间:2021年3月22