2011-07-21 74 views
0

我想在Windows下編譯Fortran 90(固定格式)庫。但是,我無法理解前置變量的錯誤。如何在使用英特爾Visual Fortran時使用預處理變量

Say the sample file is VF_TestPreprocessor.F: 

    program VF_TestPreprocessor 

    implicit Integer(A-Z) 

    Parameter (TestAlpha=22,TestBeta=TestGamma) 

    print *, TestBeta 

    end program VF_TestPreprocessor 

在Linux下,我可以使用ifort VF_TestPreprocessor.F -DTestGamma=25進行編譯和運行。

但是,在windows下,我不能用ifort VF_TestPreprocessor.F /DTestGamma=25來編譯。錯誤消息是error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [TestGamma]。你能幫助分析錯誤嗎?

回答

1

它看起來像ifort不運行預處理器。我對ifort沒有任何經驗,但this page(在ifort preprocessor上谷歌的第一次打擊)表示,在Windows上,預處理器僅在以.fpp的擴展名結尾的文件上運行。

所以,我想有(至少)兩種解決方案:

  • 重命名文件.fpp結束;
  • /fpp開關調用ifort。
+0

非常感謝您的建議!但是,這兩種解決方案都不起作用。運行「./ifort.exe VF_TestPreprocessor.F/DDEFMAXXCNAME = 25/fpp」的錯誤消息是「link:unknown option - s」,表示編譯部分成功。 (另一個線索是「./ifort.exe VF_TestPreprocessor.F/DDEFMAXXCNAME = 25/fpp/c」成功。)您能否幫助評論有關新的錯誤消息? – SOUser

+0

「link:unknown option - s」的錯誤消息實際上是我的另一個錯誤。 http://software.intel.com/en-us/forums/showthread.php?t=81388&o=d&s=lr – SOUser