Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
MEX in Matlab 7.10, 64 bit, Windows 7

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Julian Xue

Date: 24 Mar, 2010 04:57:04

Message: 1 of 9

Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?

I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:

LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
 
  C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.

Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Nikolay S.

Date: 1 Jul, 2010 06:05:20

Message: 2 of 9

"Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
>
> I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
>
> LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
>
> C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
>
> Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).

Hi.
I'm having similar issue :(

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Matthew

Date: 4 Jul, 2010 05:32:03

Message: 3 of 9

I'm having a similar issue; linker complains when trying to build the rapid simulation target in Simulink. Here's the readout for a simple gain patch:

### Building the rapid accelerator target for model: gain
Setting environment for using Microsoft Visual Studio 2008 Beta2 x64 tools.
WindowsSdkDir not found

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

cl -DRSIM_PARAMETER_LOADING /wd4996 -DEXT_MODE /Od /Oy- /DNDEBUG -DMODEL=gain -DHAVESTDIO -DNRT -DRSIM_WITH_SL_SOLVER gain.c
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

gain.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:gain.exe
gain.obj
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'
Stop.
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.

### Real-Time Workshop build procedure for model: 'gain' aborted due to an error.

"Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
>
> I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
>
> LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
>
> C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
>
> Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: David

Date: 14 Sep, 2010 21:20:24

Message: 4 of 9

"Nikolay S." <kolian1@gmail.com> wrote in message <i0hb70$8eq$1@fred.mathworks.com>...
> "Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> > Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
> >
> > I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
> >
> > LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
> >
> > C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
> >
> > Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> > or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).
>

I had this problem with my R2010b 64-bit using the VS 10.0 + Windows 7.1 SDK. The compiler doesn't like the location of yprime.c when Matlab has been installed to Program Files -- must be the spacing and the hardcoding of the directory name to "C:\PROGRA~1\" or "C:\PROGRA~2\" or whatever.

Try copying yprime.c to c:\tmp, navigate there in Matlab, and then mex-compile:
mex yprime.c

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Tung Fai

Date: 11 Jan, 2011 15:37:06

Message: 5 of 9

>
> Try copying yprime.c to c:\tmp, navigate there in Matlab, and then mex-compile:
> mex yprime.c

Yes, the compiler does work. And it is true that Matlab will not be able to handle a file name or path with space.

I always do my work under D:\MATLAB or similar due to this reason.

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Mert

Date: 14 Mar, 2012 11:40:16

Message: 6 of 9

Thank you very much!

"David" wrote in message <i6oouo$au3$1@fred.mathworks.com>...
> "Nikolay S." <kolian1@gmail.com> wrote in message <i0hb70$8eq$1@fred.mathworks.com>...
> > "Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> > > Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
> > >
> > > I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
> > >
> > > LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
> > >
> > > C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
> > >
> > > Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> > > or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).
> >
>
> I had this problem with my R2010b 64-bit using the VS 10.0 + Windows 7.1 SDK. The compiler doesn't like the location of yprime.c when Matlab has been installed to Program Files -- must be the spacing and the hardcoding of the directory name to "C:\PROGRA~1\" or "C:\PROGRA~2\" or whatever.
>
> Try copying yprime.c to c:\tmp, navigate there in Matlab, and then mex-compile:
> mex yprime.c

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Pauline

Date: 17 May, 2012 13:37:17

Message: 7 of 9

Hi ,

I have the same kind of problem. I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L , and it try to make it work on Windows 7. I managed to compile yprime.c file but all other files in which "matrix.h" is included I have these errors :

spline_roi.c(79) : error C2143: syntax error : missing ';' before 'type'
spline_roi.c(81) : error C2065: 'failed' : undeclared identifier
spline_roi.c(284) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'spline_roi.c' failed.
 
Error using mex (line 206)
Unable to complete successfully.

Someone told me to suppress -ansi option in the mexopts.bat to make it works but i have not found such an option.

Pauline

"Mert " <mertturanli@gmail.com> wrote in message <jjq030$2cl$1@newscl01ah.mathworks.com>...
> Thank you very much!
>
> "David" wrote in message <i6oouo$au3$1@fred.mathworks.com>...
> > "Nikolay S." <kolian1@gmail.com> wrote in message <i0hb70$8eq$1@fred.mathworks.com>...
> > > "Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> > > > Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
> > > >
> > > > I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
> > > >
> > > > LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
> > > >
> > > > C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
> > > >
> > > > Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> > > > or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).
> > >
> >
> > I had this problem with my R2010b 64-bit using the VS 10.0 + Windows 7.1 SDK. The compiler doesn't like the location of yprime.c when Matlab has been installed to Program Files -- must be the spacing and the hardcoding of the directory name to "C:\PROGRA~1\" or "C:\PROGRA~2\" or whatever.
> >
> > Try copying yprime.c to c:\tmp, navigate there in Matlab, and then mex-compile:
> > mex yprime.c

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: he

Date: 28 Nov, 2012 20:21:13

Message: 8 of 9

"Julian Xue" <jzxue@hotmail.com> wrote in message <hoc630$lm7$1@fred.mathworks.com>...
> Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7, using Visual C++ Express Edition 9.0?
>
> I followed all instructions on http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L exactly, and it had worked for me before on Windows Vista. Now, Matlab using mex -setup can certainly detect the compiler, but when I use it to compile something (such as yprime.c as in the example), I get the error:
>
> LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
>
> C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
>
> Is this a compiler error or a Matlab one? Could it be that my Visual C++ EE 9.0
> or my Microsoft Windows SDK is installed incorrectly? How would I find out? (I've never worked with Visual stuff, I've only used their compiler for Matlab mexing).

Really MATLAB team do not care how much time we are wasting just for its mex component?

Subject: MEX in Matlab 7.10, 64 bit, Windows 7

From: Steven_Lord

Date: 29 Nov, 2012 14:21:32

Message: 9 of 9



"he " <hesam20052000@yahoo.com> wrote in message
news:k95rnp$g3l$1@newscl01ah.mathworks.com...
> "Julian Xue" <jzxue@hotmail.com> wrote in message
> <hoc630$lm7$1@fred.mathworks.com>...
>> Hi! I was wondering if anyone got MEX to work under 64 bit Windows 7,
>> using Visual C++ Express Edition 9.0?
>>
>> I followed all instructions on
>> http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L
>> exactly, and it had worked for me before on Windows Vista. Now, Matlab
>> using mex -setup can certainly detect the compiler, but when I use it to
>> compile something (such as yprime.c as in the example), I get the error:
>>
>> LINK : fatal error LNK1104: cannot open file 'yprime.mexw64'
>> C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'yprime.mexw64'
>> failed.
>>
>> Is this a compiler error or a Matlab one? Could it be that my Visual C++
>> EE 9.0
>> or my Microsoft Windows SDK is installed incorrectly? How would I find
>> out? (I've never worked with Visual stuff, I've only used their compiler
>> for Matlab mexing).
>
> Really MATLAB team do not care how much time we are wasting just for its
> mex component?

For a response from the official Technical Support group here at MathWorks,
please contact them using the instructions in my signature. While MathWorks
staff members do read this newsgroup, not all of us are experts in MEX-file
debugging. If you contact Technical Support with this issue, it will be
automatically routed to staff members that specialize in MEX.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

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.

Contact us