0

所以我真的根本不是 Fortran 程序员,但我正在使用一些代码,这些代码使用 Fortran 中的 pgplot 图形库。我可以使用以下命令从控制台获取在 fortran 中运行的代码。

gfortran -o simple discrete.f -lpgplot -IX11

离散.f 是文件的名称。所以当我从控制台运行它时这有效。但是,我想在 eclipse photran 插件中运行代码,以便我可以使用调试器,以便我可以单步执行代码并观察一些变量。我试图将 -lpgplot 和 -IX11 标志放在 Eclipse 中,但我收到关于 pgbbuf 和 pgnumb_ 函数作为未定义引用的错误(这意味着从 Eclipse 调用时 -lpgplot 函数不起作用。

谁能告诉我如何正确设置标志以在 Photran 中运行此代码,以便我可以编译它并看到 pgplot 图形出现?

我正在添加控制台输出:

02:57:05 **** Clean-only build of configuration Debug for project burglar_code_martin ****
make clean 
rm -rf  ./burglary_model.o  burglar_code_martin


02:57:05 Build Finished (took 61ms)

02:57:05 **** Build of configuration Debug for project burglar_code_martin ****
make all 
Building file: ../burglary_model.f
Invoking: GNU Fortran Compiler
gfortran -funderscoring -I/usr/lib -O0 -g -Wall -c -fmessage-length=0 -lpgplot -IX11 -o "burglary_model.o" "../burglary_model.f"
Warning: Nonconforming tab character in column 1 of line 225
Warning: Nonconforming tab character in column 1 of line 228
../burglary_model.f:155.27:

            call probcheck(frac,1,outc)                                 
                           1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:54.33:

                  call probcheck(robprob,1,outcome)                     
                                 1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:95.30:

               call probcheck(placeprob,1,outcome)                      
                              1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:206.36:

      subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)            
                                    1
Warning: Unused dummy argument 'burgsatloc' at (1)
../burglary_model.f:206.44:

      subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)            
                                            1
Warning: Unused dummy argument 'pic' at (1)
../burglary_model.f:206.51:

      subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)            
                                                   1
Warning: Unused dummy argument 'screen' at (1)
../burglary_model.f:145.32:

      integer l,pic,screen,i,j,k,PGOPEN,burgsatloc(512,*),nbar,outc     
                                1
Warning: Unused variable 'k' declared at (1)
../burglary_model.f:146.15:

      real rand,red,green,blue                                          
               1
Warning: Unused variable 'rand' declared at (1)
../burglary_model.f:143.53:

      subroutine initialize(burgsatloc,B,l,pic,screen,rbar,Bbar)        
                                                     1
Warning: Unused dummy argument 'screen' at (1)
../burglary_model.f:4.58:

      integer i,j,n,l,pic,screen,guy,burgsatloc(512,512),k,             
                                                          1
Warning: Unused variable 'k' declared at (1)
Finished building: ../burglary_model.f

Building target: burglar_code_martin
Invoking: GNU Fortran Linker
gfortran -lpgplot -IX11 -o "burglar_code_martin"  ./burglary_model.o   
./burglary_model.o: In function `output_':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:241: undefined reference to `pgbbuf_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:242: undefined reference to `pgnumb_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:244: undefined reference to `pgenv_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:246: undefined reference to `pglab_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:247: undefined reference to `pgimag_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:253: undefined reference to `pgebuf_'
./burglary_model.o: In function `initialize_':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:165: undefined reference to `pgopen_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:168: undefined reference to `pgpap_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:169: undefined reference to `pgask_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:170: undefined reference to `pgscir_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:175: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:181: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:187: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:193: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:199: undefined reference to `pgscr_'
./burglary_model.o: In function `implicit':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:109: undefined reference to `pgclos_'
collect2: ld returned 1 exit status
make: *** [burglar_code_martin] Error 1

02:57:05 Build Finished (took 209ms)
4

0 回答 0