VSCode配置Fortran环境

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 launch.json and tasks.json files.

Makefile Tools [Microsoft, optional]

You can set make command in tasks.json or use this plugin to compile make project.

// vscode settings
{
    "makefile.launchConfigurations": [
        {
            "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
-- main.cpp
-- module.cpp
-- header.h
- 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
.cpp.o:
    $(GCC) -c $(HEADER) $(FLAGS) $(GCCFLAGS) -fpermissive -o $@ #html#lt;

.c.o:
    $(GC) -c $(HEADER) $(FLAGS) -fpermissive -o $@ #html#lt;

$(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
{
    "fprettify.arguments": "-i 4 --case 1 1 1 2"
}

本文链接:VSCode配置Fortran环境

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:PorYoung,谢谢!^^

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇