Undefined Link, Plplot related error with GFortran

I tried to compile the following Fortran code found at http://techlogbook.wordpress.com/200...-kubuntu-8-04/

program testplplot2d
use plplot
implicit none
real(plflt),dimension(6) :: x,y
real(plflt)::xmin,xmax,ymin,ymax
x=(/1,2,3,4,5,6/)
y=x**2
write(*,*) y
call plinit()
xmin=1.0
xmax=6.0
ymin=1.0
ymax=40.0
call plcol0(1)
call plenv(xmin,xmax,ymin,ymax,0,0)
call pllab('X','Y','Test 1D plot')
call plpoin(x,y,9)
call plline(x,y)
y=x**3
call plpoin(x,y,9)
call plline(x,y)
call plend()

end program testplplot2d

In an attempt to compile the program, I used the following command:

gfortran -I/usr/lib/fortran/modules/plplot testplot2d.f90 -o testplot2d

However, I received a communication error message, described in detail below:

/tmp/cckSqEg4.o: In function `MAIN__':
testplot2d.f90:(.text+0x10c): undefined reference to `plinit_'
testplot2d.f90:(.text+0x154): undefined reference to `plcol0_'
testplot2d.f90:(.text+0x181): undefined reference to `plenv_'
testplot2d.f90:(.text+0x1a6): undefined reference to `__plplotp_MOD_pllab'
testplot2d.f90:(.text+0x248): undefined reference to `__plplot_MOD_plpoin'
testplot2d.f90:(.text+0x2e5): undefined reference to `__plplot_MOD_plline'
testplot2d.f90:(.text+0x3c6): undefined reference to `__plplot_MOD_plpoin'
testplot2d.f90:(.text+0x463): undefined reference to `__plplot_MOD_plline'
testplot2d.f90:(.text+0x46d): undefined reference to `plend_'
collect2: ld returned 1 exit status

What should I do to fix this problem? (I read the man pages for gfortran, and I believe that I am using the correct option to link to the library.)

+3
source share
4 answers

I posted this on ubuntuforums. Gmargo sent the following solution:

libplplot-dev :

gfortran testplot2d.f90 -o testplot2d $(pkg-config --cflags --libs plplotd-f95)

@belisarius @High-Performance-Mark .

+1

, , , . gfortran,

-I ( Linux Unix, ) , , , . Fortran .mod, , .

, , , USE , , , .

Linux -L, . - :

-L/path/to/installed/lib/files -lplplot

. gfortran, , , , gfortran, .

+2

.

, :

libplplot Kubuntu Adept libplplot-fortran9.

, .

0

, gfortran testplot2d.f90 -o testplot2d $ (pkg-config --cflags --lpls plplotd-f95)

:

$ (pkg-config --cflags --lpls plplotd-f95) plplotd-f95 pkg-config. , , "plplotd-f95.pc" PKG_CONFIG_PATH. "plplotd-f95" testplplot2d.f90: 2: 4:

use plplot 1 Fatal Error: plplot.mod (1): .

?

0

Source: https://habr.com/ru/post/1778828/


All Articles