Fortran Coder

标题: plplot绘图函数库在vs2010+win7下的安装与使用 [打印本页]

作者: mangix2010    时间: 2014-5-8 20:59
标题: plplot绘图函数库在vs2010+win7下的安装与使用
plplot是一款开源跨平台的绘图函数库,具有多种语言接口,可用于某些科学计算图形显示,官方网站为http://plplot.sourceforge.net/
我的配置环境:vs2010 + ivf XE2013+plplot5.10.0+Cmake2.8.12
之前vs和ivf需要安装好,这个可以参考其他的教程,在此省略。下面简单介绍一下的配置过程。
1. 下载plplot数据文件
到网站 https://sourceforge.net/projects/plplot/ 下载 plplot-5.10.0.tar.gz


将压缩文件解压到单独一个文件夹中,比如 D:\plplot
2. 安装cmake
到cmake官网http://www.cmake.org/cmake/resources/software.html下载安装cmake的windows版本


3. 利用cmake生成vs解决方案
在D:\plplot下新建一个文件夹plplot_vs作为vs编译文件夹,从windows开始菜单打开cmake-gui,
然后选择输入文件夹和输出文件夹


点击左下角configure按钮,选择编译器版本,我这里是vs2010, 注意是64位的要选64位版本,点击finish

configure完成后确定enable_f95勾选上,然后点击generate生成解决方案


4. 编译vs解决方案
从文件夹D:\plplot\plplot_vs下打开plplot.sln,cmake后有点小问题需要进行如下操作,
工程plplotf95cd 右键-》属性,预处理定义中添加IVF,应用后确定


工程plplotf95d,右键 -》属性,模块定义文件改为plplotf95_ifort.def,应用后确定
然后生成ALL_BUILD工程,这样就完成了plplot的编译。

5. plplot测试
在D:\plplot\plplot_vs目录下新建一个工程plplotgraph(如果不是在安装目录下需要修改环境变量
(参考https://www.mail-archive.com/plp ... e.net/msg01381.html
编辑如下代码(plplot测试例子1)
program x00f95
    use plf95demolib

    integer, parameter :: NSIZE = 101

    real(kind=plflt), dimension(NSIZE) :: x, y

    real(kind=plflt) :: xmin = 0._plflt, xmax = 1._plflt, ymin = 0._plflt, ymax = 100._plflt
    ! integer          :: i

    ! Prepare data to be plotted.
    x = arange(0, NSIZE) / real(NSIZE-1,plflt)
    y = ymax * x**2

    ! Or alternatively, using a DO-loop
    !do i = 1,NSIZE
    !    x(i) = real( i - 1, plflt ) / real( NSIZE - 1, plflt )
    !    y(i) = ymax * x(i)**2
    !enddo

    ! Parse and process command line arguments
    call plparseopts( PL_PARSE_FULL )

    ! Initialize plplot
    call plinit

    ! Create a labelled box to hold the plot.
    call plenv( xmin, xmax, ymin, ymax, 0, 0 )
    call pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" )

    ! Plot the data that was prepared above.
    call plline( x, y )

    ! Close PLplot library
    call plend

end program x00f95


开始编译前,配置工程的project/properity,项目>属性,将fortran libraries>Runtime library中的设置修改成 mutithread


进入linker >general如下的界面:在additional library directories 中添加D:\plplot\plplot_vs\dll\Debug



按到linker下的input界面在addtional dependencies输入csirocsa.lib mem.lib null.lib plf95demolibd.lib
plplotcxxd.lib plplotd.lib plplotf95cd.lib plplotf95d.lib ps.lib qsastime.lib svg.lib xfig.lib


开始编译,生成项目,然后设为启动项目执行


比如选择6,生成test.svg文件,结果如下




以上就是在win7+VS2010下配置plplot的过程。

鸣谢:
      (1)感谢米のこ芾 的支持与帮助,相关讨论见帖子 http://www.fcode.cn/bbs/forum.ph ... ge=1&extra=#pid1198
      (2)感谢珊瑚虫同学的dislin配置帖子, 很多内容是参考该贴配置的,http://www.fcode.cn/bbs/forum.ph ... typeid%26typeid%3D9



作者: fcode    时间: 2014-5-8 21:05
感谢楼主分享
作者: henry67h    时间: 2014-5-8 21:12
涨姿势了
作者: aliouying    时间: 2014-5-8 23:46
收藏一下~
作者: lm_lxt    时间: 2014-5-9 08:41
好贴!好图。
作者: 瑶远梦想    时间: 2014-6-15 23:06
请问下win7是64的可以吗?
作者: fcode    时间: 2014-6-15 23:23
瑶远梦想 发表于 2014-6-15 23:06
请问下win7是64的可以吗?

开源函数库,无所谓支持不支持。如果不支持,自己在自己的编译器上重新编译既可。
作者: 瑶远梦想    时间: 2014-6-16 00:41
fcode 发表于 2014-6-15 23:23
开源函数库,无所谓支持不支持。如果不支持,自己在自己的编译器上重新编译既可。 ...

谢谢哈!
作者: Mr.未    时间: 2015-5-19 19:24
在 将fortran libraries>Runtime library中的设置修改成 mutithread  这一步的时候出错,说是属性值无效。请问这是什么原因,应该怎么解决?  我用的VS2010+IVF2015.
作者: fcode    时间: 2015-5-19 19:53
Mr.未 发表于 2015-5-19 19:24
在 将fortran libraries>Runtime library中的设置修改成 mutithread  这一步的时候出错,说是属性值无效。 ...

这个是在列表里选择的吧?怎么可能无效呢?
作者: Mr.未    时间: 2015-5-19 22:12
fcode 发表于 2015-5-19 19:53
这个是在列表里选择的吧?怎么可能无效呢?

问题已经解决了。但是在运行测试程序的时候出现很多错误。请问这是怎么回事?

1.png (49.39 KB, 下载次数: 385)

1.png

作者: Mr.未    时间: 2015-5-21 22:09
fcode 发表于 2015-5-19 19:53
这个是在列表里选择的吧?怎么可能无效呢?

我的配置是ivf xe2015+vs2010
作者: Mr.未    时间: 2015-5-21 22:22
本帖最后由 Mr.未 于 2015-5-21 22:26 编辑
fcode 发表于 2014-6-15 23:23
开源函数库,无所谓支持不支持。如果不支持,自己在自己的编译器上重新编译既可。 ...

       这是我按照教程来的,解决方案中缺少图1中所说的两个工程,具体从图2中可以看出来。真的非常麻烦!

1.png (45.35 KB, 下载次数: 542)

1.png

2.png (26.19 KB, 下载次数: 512)

2.png

作者: Caesar    时间: 2015-8-14 10:37
请问每次configure 都不成功是咋回事啊E:\桌面的储存地\数学建模
作者: Caesar    时间: 2015-8-14 10:37

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.vcxproj"

The C compiler identification is MSVC, found in "E:/plplot/plplot_vs/CMakeFiles/3.3.1/CompilerIdC/CompilerIdC.exe"
到这里就卡住了
作者: Caesar    时间: 2015-8-14 10:39
CMake Error at CMakeLists.txt:64 (enable_language):
  No CMAKE_C_COMPILER could be found.
作者: 晒sunstar    时间: 2016-8-12 10:50
大家好。
我已经用Cmake编译出了PLplot 5.11.1。
但是在运行示例程序时,出现了错误“ error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [PLPLOT]”,如图:

这是由于“include 设置不正确,编译器找不到 PLPLOT.mod 文件”造成的。可是我已经加入了路径了,如图:


其他“libraries”、“multithreded”、“Linker-general”、“Linker-input”也都改好了,还是报错

PS:我在教程里看到这个:

可能和我的问题有关吗?(但我就是在plplot_vs下新建的工程,应该不是这个原因了


作者: tyli_09    时间: 2016-10-18 17:12
学习了,谢谢楼主!
作者: 山林悍匪    时间: 2017-2-20 11:35
太好了,以前都没点开这个帖子,多谢楼主
作者: wdy    时间: 2018-4-18 10:48
本帖最后由 wdy 于 2018-4-18 15:09 编辑

用最新版的5.13.0是Enable_fortran而不是Enable_f95,generate不能通过,我绕了好大一个圈子
然而在运行测试程序时还是出现了编译错误,伤心~

Cmake05.jpg (93.37 KB, 下载次数: 539)

Cmake05.jpg

Cmake06.jpg (68.55 KB, 下载次数: 491)

Cmake06.jpg

Image 10.png (37.43 KB, 下载次数: 527)

Image 10.png

作者: HStar-X    时间: 2020-7-5 22:57
按照这个帖子的方法 http://fcode.cn/bbs/thread-168-1-1.html  把安装Plplot在VS2010+IVF里,编译 测试例子 时,出现了报错,应该怎么处理呀?






欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2