本帖最后由 harptraveler 于 2018-10-22 02:18 编辑  
 
各位大神,本人被从fortran调用matlab问题困扰了两个礼拜,特来求助,请大家不吝赐教!感激不尽! 我的操作环境  
系统:64位win10;Matlab版本:2018a;Fortran编译器:Intel parallel studio XE 2017fortran + Microsoft visual studio 2017;编译平台:Debug x64 
  
  问题描述:  
试图用VS调用Matlab,无论VS中的程序是什么(即便是一个空程序),总会对第一行报错,output如下:  
1>------ Build started: Project: Console2, Configuration: Debug x64 ------ 
1>Compiling with Intel(R) Visual Fortran Compiler 17.0.7.272 [Intel(R) 64]... 
1>Source1.f90 
1>C:\Users\Rui\FORTRAN\Console2\Console2/Source1.f90(1): error #5078: Unrecognized token '?' skipped 
1>C:\Users\Rui\FORTRAN\Console2\Console2/Source1.f90(1): error #5078: Unrecognized token '?' skipped 
1>C:\Users\Rui\FORTRAN\Console2\Console2/Source1.f90(1): error #5078: Unrecognized token '?' skipped 
1>compilation aborted for C:\Users\Rui\FORTRAN\Console2\Console2\Source1.f90 (code 1) 
1> 
1>Build log written to  "file://C:\Users\Rui\FORTRAN\Console2\Console2\x64\Debug\BuildLog.htm" 
1>Console2 - 4 error(s), 0 warning(s) 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
  
 
 
问题似乎出在Process source file上。当这一项为默认选项No的时候,没有上述问题,当然程序也无法编译。当把这一项改为Yes(/fpp)后,便会出现上述错误。 
 其他信息: 1.Matlab中用mex命令可以识别Intel Fortran  
2.已在win10的环境变量中添加matlab路径  
3.已将操作平台改为x64  
4.已在项目-属性-Fortran-General里的AdditionalInclude Directories添加include  
5. 已在项目-属性-Linker-General里的Additionallibrary directories里添加lib/win64/Microsoft  
6. 已在项目-属性-linker-Input里的AdditionalDependencies里添加libmx.lib libmat.lib libeng.lib 谢谢大家!  
  
  
 
 |