Thread Subject: MEX basics help ; URGENT !!

Subject: MEX basics help ; URGENT !!

From: Charan

Date: 18 Dec, 2007 05:18:37

Message: 1 of 6

I am a newbie to MEX functions.

I took the timestwo.f in the help in Matlab and tried to run
the function but i got the following error.

I also bought a Intel Fortran Compiler 10.1(academic
version). The steps I followed are as follows:

1) Mex- setup

2) the compiler was not in the list (Intel fortran 9.0 was
only there)

3) so I changed the directory when it asked me to verify the
location of the compiler to THE DIRECTORY of FORTRAN 10.1

then after loading the complier (screen output for these
steps are shown below the error portion)

4) when I typed "mex timestwo.f" we got the following error

I really appreciate your help

Thanks,
Charan


//---------------------error output------------------------
 
>> mex timestwo.f
timestwo.f(15) : Error: Syntax error, found ',' when
expecting one of: <END-OF-STATEMENT> ;
      integer nlhsx=2, nrhs
---------------------^
timestwo.f(16) : Error: A specification statement cannot
appear in the executable section.
      integer m, n, size
------^
timestwo.f(17) : Error: A specification statement cannot
appear in the executable section.
      real*8 x, y
------^
compilation aborted for timestwo.f (code 1)
 
  C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Compile of
'timestwo.f' failed.
 
??? Error using ==> mex at 208
Unable to complete successfully.
------------------------------------------------------------

>> mex -setup
Please choose your compiler for building external interface
(MEX) files:
 
Would you like mex to locate installed compilers [y]/n? n
 
Select a compiler:
[1] Borland C++ Compiler (free command line tools) 5.5
[2] Borland C++Builder 6.0
[3] Borland C++Builder 5.0
[4] Compaq Visual Fortran 6.1
[5] Compaq Visual Fortran 6.6
[6] Intel C++ 9.1 (with Microsoft Visual C++ 2005 linker)
[7] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005
linker)
[8] Intel Visual Fortran 9.0 (with Microsoft Visual C++ 2005
linker)
[9] Intel Visual Fortran 9.0 (with Microsoft Visual C++ .NET
2003 linker)
[10] Lcc-win32 C 2.4.1
[11] Microsoft Visual C++ 6.0
[12] Microsoft Visual C++ .NET 2003
[13] Microsoft Visual C++ 2005
[14] Microsoft Visual C++ 2005 Express Edition
[15] Open WATCOM C++ 1.3
 
[0] None
 
Compiler: 9
 
The default location for Intel Visual Fortran compilers is
C:\Program Files (x86)\Intel\Compiler\Fortran\9.0,
but that directory does not exist on this machine.
 
Use C:\Program Files (x86)\Intel\Compiler\Fortran\9.0 anyway
[y]/n? n
Please enter the location of your compiler: [C:\Program
Files (x86)\Intel\Compiler\Fortran\9.0] C:\Program
Files\Intel\Compiler\Fortran\10.1.011
 
Please verify your choices:
 
Compiler: Intel Visual Fortran 9.0
Location: C:\Program Files\Intel\Compiler\Fortran\10.1.011
 
Are these correct?([y]/n): y
 
***************************************************************************

  Warning: The Intel Visual Fortran 9.0 compiler is being
phased out
           and will not be supported in a future release.
           For a list of currently supported compilers see:
          
http://www.mathworks.com/support/tech-notes/1600/1601.html
***************************************************************************

 
Trying to update options file: C:\Documents and
Settings\Akhil\Application
Data\MathWorks\MATLAB\R2007b\mexopts.bat
From template:
C:\PROGRA~1\MATLAB\R2007b\bin\win32\mexopts\intelf90msvs2003opts.bat

 
Done . . .

-----------------------------------------------------------

Subject: MEX basics help ; URGENT !!

From: James Tursa

Date: 18 Dec, 2007 09:23:54

Message: 2 of 6

>
>//---------------------error output------------------------
>
>>> mex timestwo.f
>timestwo.f(15) : Error: Syntax error, found ',' when
>expecting one of: <END-OF-STATEMENT> ;
> integer nlhsx=2, nrhs
>---------------------^
>timestwo.f(16) : Error: A specification statement cannot
>appear in the executable section.

It appears that somehow the statement x=2 got put in the middle of the
specification statement. The line should read:

      integer nlhs, nrhs

James Tursa

Subject: MEX basics help ; URGENT !!

From: Charan

Date: 18 Dec, 2007 18:55:46

Message: 3 of 6

James Tursa <aclassyguywithaknotac@hotmail.com> wrote in
message <b54fm3h8mq0a69lr2om8i7gk2d6rb46p65@4ax.com>...
> >
> >//---------------------error output------------------------
> >
> >>> mex timestwo.f
> >timestwo.f(15) : Error: Syntax error, found ',' when
> >expecting one of: <END-OF-STATEMENT> ;
> > integer nlhsx=2, nrhs
> >---------------------^
> >timestwo.f(16) : Error: A specification statement cannot
> >appear in the executable section.
>
> It appears that somehow the statement x=2 got put in the
middle of the
> specification statement. The line should read:
>
> integer nlhs, nrhs
>
> James Tursa


I am so sorry ...but that was an error in the code...

but the error which shows up now is

//------------error-----------------------------------
>> mex timestwo.f
'link' is not recognized as an internal or external command,
operable program or batch file.
 
  C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of
'timestwo.mexw32' failed.
 
??? Error using ==> mex at 208
Unable to complete successfully.

------------------------------------------------

We think this could be due to the compiler linker...
We are using Intel Visual Fortran 10.1.011

Thanks,
Charan

Subject: MEX basics help ; URGENT !!

From: James Tursa

Date: 19 Dec, 2007 07:52:10

Message: 4 of 6

On Tue, 18 Dec 2007 18:55:46 +0000 (UTC), "Charan "
<boyacharan@gmail.com> wrote:
>
>but the error which shows up now is
>
>//------------error-----------------------------------
>>> mex timestwo.f
>'link' is not recognized as an internal or external command,
>operable program or batch file.
>
> C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of
>'timestwo.mexw32' failed.
>
>??? Error using ==> mex at 208
>Unable to complete successfully.
>
>------------------------------------------------
>
>We think this could be due to the compiler linker...
>We are using Intel Visual Fortran 10.1.011
>
>Thanks,
>Charan

So it appears that you are fooling MATLAB into thinking it is using
the Intel 9.0 compiler but really pointing it to the 10.1 directory.
That means it is still using the intelf90msvs2003opts.bat file that is
specific to the 9.0 compiler, and probably other 9.0 specific files as
well. I can only wish you luck. I tried something like this in the
past and never was successful. You could try copying the following
files:

    intelf90msvs2003opts.bat
    intelf90engmatopts.bat
    intelf90opts.bat
    intelf90opts.stp

    (or whatever specific 9.0 files that came with your version)

into new files:

    intelf101msvs2003opts.bat
    intelf101engmatopts.bat
    intelf101opts.bat
    intelf101opts.stp

and then hand editing them for the 10.1 specific infomation that you
need. At least MATLAB will find your compiler with the "mex -setup"
command. But like I said, I never got this approach to work so I
can't really give you specifics as to how to modify the files.
Particularly for the linker and linker options. Good luck ...

James Tursa

Subject: MEX basics help ; URGENT !!

From: James Tursa

Date: 23 Dec, 2007 08:55:49

Message: 5 of 6

On Wed, 19 Dec 2007 07:52:10 GMT, James Tursa
<aclassyguywithaknotac@hotmail.com> wrote:

>On Tue, 18 Dec 2007 18:55:46 +0000 (UTC), "Charan "
><boyacharan@gmail.com> wrote:
>>
>>but the error which shows up now is
>>
>>//------------error-----------------------------------
>>>> mex timestwo.f
>>'link' is not recognized as an internal or external command,
>>operable program or batch file.
>>
>> C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of
>>'timestwo.mexw32' failed.
>>
>>??? Error using ==> mex at 208
>>Unable to complete successfully.
>>
>>------------------------------------------------
>>
>>We think this could be due to the compiler linker...
>>We are using Intel Visual Fortran 10.1.011
>>
>>Thanks,
>>Charan
>
>So it appears that you are fooling MATLAB into thinking it is using
>the Intel 9.0 compiler but really pointing it to the 10.1 directory.
>That means it is still using the intelf90msvs2003opts.bat file that is
>specific to the 9.0 compiler, and probably other 9.0 specific files as
>well. I can only wish you luck. I tried something like this in the
>past and never was successful. You could try copying the following
>files:
>
> intelf90msvs2003opts.bat
> intelf90engmatopts.bat
> intelf90opts.bat
> intelf90opts.stp
>
> (or whatever specific 9.0 files that came with your version)
>
>into new files:
>
> intelf101msvs2003opts.bat
> intelf101engmatopts.bat
> intelf101opts.bat
> intelf101opts.stp
>
>and then hand editing them for the 10.1 specific infomation that you
>need. At least MATLAB will find your compiler with the "mex -setup"
>command. But like I said, I never got this approach to work so I
>can't really give you specifics as to how to modify the files.
>Particularly for the linker and linker options. Good luck ...
>
>James Tursa


P.S. If you ever do get this to work I would be interested in knowing
how you did it.

James Tursa

Subject: MEX basics help ; URGENT !!

From: Charan

Date: 2 Jan, 2008 05:23:19

Message: 6 of 6

Hi James,

So what is the alternative?

Try another version of Compiler? I will try your steps anyways.

Thanks,
Charan

James Tursa <aclassyguywithaknotac@hotmail.com> wrote in
message <ge8sm3hrssv9mch2gffgpq4cth3q8n5jio@4ax.com>...
> On Wed, 19 Dec 2007 07:52:10 GMT, James Tursa
> <aclassyguywithaknotac@hotmail.com> wrote:
>
> >On Tue, 18 Dec 2007 18:55:46 +0000 (UTC), "Charan "
> ><boyacharan@gmail.com> wrote:
> >>
> >>but the error which shows up now is
> >>
> >>//------------error-----------------------------------
> >>>> mex timestwo.f
> >>'link' is not recognized as an internal or external
command,
> >>operable program or batch file.
> >>
> >> C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of
> >>'timestwo.mexw32' failed.
> >>
> >>??? Error using ==> mex at 208
> >>Unable to complete successfully.
> >>
> >>------------------------------------------------
> >>
> >>We think this could be due to the compiler linker...
> >>We are using Intel Visual Fortran 10.1.011
> >>
> >>Thanks,
> >>Charan
> >
> >So it appears that you are fooling MATLAB into thinking
it is using
> >the Intel 9.0 compiler but really pointing it to the 10.1
directory.
> >That means it is still using the intelf90msvs2003opts.bat
file that is
> >specific to the 9.0 compiler, and probably other 9.0
specific files as
> >well. I can only wish you luck. I tried something like
this in the
> >past and never was successful. You could try copying the
following
> >files:
> >
> > intelf90msvs2003opts.bat
> > intelf90engmatopts.bat
> > intelf90opts.bat
> > intelf90opts.stp
> >
> > (or whatever specific 9.0 files that came with your
version)
> >
> >into new files:
> >
> > intelf101msvs2003opts.bat
> > intelf101engmatopts.bat
> > intelf101opts.bat
> > intelf101opts.stp
> >
> >and then hand editing them for the 10.1 specific
infomation that you
> >need. At least MATLAB will find your compiler with the
"mex -setup"
> >command. But like I said, I never got this approach to
work so I
> >can't really give you specifics as to how to modify the
files.
> >Particularly for the linker and linker options. Good luck ...
> >
> >James Tursa
>
>
> P.S. If you ever do get this to work I would be interested
in knowing
> how you did it.
>
> James Tursa

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fortran Charan 2 Jan, 2008 00:25:02
mex Charan 2 Jan, 2008 00:25:02
mex fortran com... Charan 18 Dec, 2007 00:20:14
rssFeed for this Thread

Contact us at files@mathworks.com