李鹏杰
在Vscode中使用Makefile文件实现POD程序的编译调试
2022-5-7 18:09
阅读:5700

在执行本文操作前应下载Ginan软件的源码(下载地址:GeoscienceAustralia/ginan: The Australian Government, through Positioning Australia (part of Geoscience Australia), is funding the design, development and operational service of a Global Navigation Satellite System (GNSS) position correction system - the Ginan service and toolkit. The application of the Ginan correction service by a GNSS device has the potential to increase positioning accuracy from meters to centimetres across Australia. The suite of software systems in this repository (the Ginan toolkit) will be used to create the service. It is available now under an open source licence. Ginan will give individuals and organisations no-cost access to the Ginan software and service as a public good. (github.com))提取POD模块相关的Fortran源码并编写Makefile文件。在Vscode中结合Makefile文件编译调试POD程序主要由以下几个步骤实现:

1、不熟悉Makefile文件编写,可以借助codeblock软件实现自动生成。

image.png

image.png

image.png

image.png

image.png

image.png

2、使用make命令向Makefile文件传递参数;

对步骤1中生成的Makefile文件进行适当修改。在Makefile文件中加入“CFLAGS = ${CFLAG}”,在执行make命令时直接指定变量CFLAGS的值,然后Makefile文件将根据输入的CFLAG的值来执行不同版本的gfortran命令进行编译。其中,执行“make CFLAG=-g”命令,将生成debug版本;执行“make CFLAG= -O3”命令,将生成release版本;执行“make clean”命令,将清理生成的可执行文件。

# make CFLAG=-g

# make CFLAG= -O3

# make clean

image.png

image.png


3、创建pod_main项目:

image.png

image.png

image.png

image.png

4、配置launch.json、tasks.json文件:

launch.json文件:

image.png

可执行文件路径:

image.png

调试程序的工作路径:

image.png

tasks.json文件:

image.png

5、使用“make CFLAG=-g”构建POD可执行文件及使用“make clean”进行清理:

image.png

image.png


6、打断点进行POD模块程序调试:

image.png

image.png

    依赖库:lib.tar.gz


参考博文

1、vsCode中使用makefile实现debug/release版本的编译_myyanjie的博客-CSDN博客_vscode中使用make

2、linux+vsCode+makefile -- 调试C_不一样的清流的博客-CSDN博客_vscode 调试makefile

3、VSCode 结合Makefile设置调试方法_gbmaotai的博客-CSDN博客_makefile vscode

4、Vscode 打开终端窗口_清风自在 流水潺潺的博客-CSDN博客_vscode运行终端

5、codeblocks使用fortran - CSDN













转载本文请联系原作者获取授权,同时请注明本文来自李鹏杰科学网博客。

链接地址:https://wap.sciencenet.cn/blog-3486472-1337493.html?mobile=1

收藏

分享到:

当前推荐数:0
推荐到博客首页
网友评论0 条评论
确定删除指定的回复吗?
确定删除本博文吗?