Compiling C and Fortran source files in a single call to MEX.

3 views (last 30 days)
I'm having difficulties installing PottersWheel toolbox for Matlab 64-bit. The error message I get is:
Problem detected at 2015-03-29 18:22:24: Error using mex Cannot compile both C and FORTRAN source files in a single call to MEX.
Line 339 of pwCompileFortranIntegrators.p Line 70 of pwInstall.p Matlab 2015a (mexw64) PottersWheel 3.1.2 -------------------------------------------
I followed the instructions exactly from their website and I still get this error. Does anybody know how to fix my problem? Is there a way to manually compile the necessary code?

Answers (1)

James Tursa
James Tursa on 30 Mar 2015
Edited: James Tursa on 30 Mar 2015
Compile the source code without the mexFunction first using the -c option (compile only). That will produce an object file. Then compile the other source code that does have the mexFunction and include the object file name on the mex command. E.g., suppose you had two files:
myfunction.f <-- the Fortran source file that contains the mexFunction
myroutines.c <-- the C source that contains routines that myfunction uses
The sequence of mex'ing would be:
mex -c myroutines.c
mex myfunction.f myroutines.obj
The .obj is what you would get on a Windows system. You will get a different object extension on other systems.
On older versions of MATLAB, you will have to use mex -setup prior to the mex calls to make sure the proper compiler is selected.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!