首页 > 解决方案 > 在模块中找不到 (1) 中引用的非法预处理器指令和符号

问题描述

我正在尝试用其他一些包编译 Quantum ESPRESSO 代码。在使用 Makefile 并稍微编译标志之后,我“获得”了如下错误。有没有办法解决这个问题?我是否缺少任何标志以避免错误?还是来自代码本身?

$ mpif90 -fdollar-ok -ffree-line-length-none -O3 -fopenmp -fPIC -I ../../../qe/6.0-mpi/Modules -I ../src -I ../src ../../../qe/6.0-mpi/PW/src/libpw.a ../../../qe/6.0-mpi/Modules/libqemod.a ../../../qe/6.0-mpi/FFTXlib/libqefft.a ../../../qe/6.0-mpi/LAXlib/libqela.a -Wall -c qevars.f90 
Warning: qevars.f90:30: Illegal preprocessor directive
Warning: qevars.f90:32: Illegal preprocessor directive
Warning: qevars.f90:34: Illegal preprocessor directive
Warning: qevars.f90:56: Illegal preprocessor directive
Warning: qevars.f90:58: Illegal preprocessor directive
Warning: qevars.f90:60: Illegal preprocessor directive
Warning: qevars.f90:68: Illegal preprocessor directive
Warning: qevars.f90:70: Illegal preprocessor directive
Warning: qevars.f90:72: Illegal preprocessor directive
Warning: qevars.f90:74: Illegal preprocessor directive
Warning: qevars.f90:75: Illegal preprocessor directive
Warning: qevars.f90:77: Illegal preprocessor directive
qevars.f90:33:43:

     use io_files,   ONLY : nd_nmbr, prefix, outdir, tmp_dir, nwordwfc, iunwfc
                                           1
Error: Symbol ‘outdir’ referenced at (1) not found in module ‘io_files’
qevars.f90:73:43:

     use wvfct,      ONLY : npw, npwx, nbnd, igk, g2kin, wg, et, ecutwfc
                                           1
Error: Symbol ‘igk’ referenced at (1) not found in module ‘wvfct’
qevars.f90:73:63:

     use wvfct,      ONLY : npw, npwx, nbnd, igk, g2kin, wg, et, ecutwfc
                                                               1
Error: Symbol ‘ecutwfc’ referenced at (1) not found in module ‘wvfct’
qevars.f90:71:43:

     use wvfct,      ONLY : npw, npwx, nbnd, igk, g2kin, wg, et
                                           1
Error: Symbol ‘igk’ referenced at (1) not found in module ‘wvfct’

标签: compiler-errorsfortrangfortran

解决方案


错误消息和警告,例如

Warning: qevars.f90:30: Illegal preprocessor directive

通常由包含预处理器指令但不由预处理器预处理的 Fortran 代码处理。在 gfortran 中使用来启用预处理器或使用带有大写 F ( , )-cpp的文件扩展名。.F.F90

缺乏预处理可能会导致报告许多以下错误。


推荐阅读