MATLAB Answers

0

mex compile is not working

steven fraser さんによって質問されました 2015 年 1 月 6 日
最新アクティビティ Martin Gulan さんによって 編集されました 2015 年 1 月 9 日
I have installed the Microsoft Visual C++ 2010 compiler. I am running 64 bit matlab on a 64 bit machine, matlab 2010b. The compiler works when running stateflow models.
When I try to mex a .c file I get this:
>> mex write_c.c
C:\Users\STEVE~1.FRA\AppData\Local\Temp\mex_4UINXY\write_c.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
C:\PROGRA~1\MATLAB\R2010B~1\BIN\MEX.PL: Error: Link of 'write_c.mexw64' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
What is wrong?

  1 件のコメント

Titus Edelhofer
2015 年 1 月 6 日
Hi Steven,
just to be sure: I assume you wrote
mex write_c.c
and the "C:\Users\..." is already the error message. Try
mex -v write_c.c
and take a look at the output (or post it here for help) ...
Titus

サインイン to comment.

タグ

1 件の回答

Aditya Jain
回答者: Aditya Jain
2015 年 1 月 8 日

The issue arises due to a Microsoft product bug where if you have installed Visual Studio 2010 Service Pack 1 on a system with Windows SDK 7.1, then the x64 compilers and Visual C++ libraries are removed.
You can access the following link for more information on this:
The following link from Microsoft provides a resolution to the issue:
The download page for the update of the SDK compilers is mentioned below:

  1 件のコメント

Martin Gulan 2015 年 1 月 9 日
Dear Aditya and others;
when I run
>>mex work/obj_target/test.obj work/interface/test_mex.c -output test
I receive almost the same output, i.e.:
Building with 'Microsoft Visual C++ 2012 (C)'.
Error using mex
work/obj_target/test.obj: fatal error LNK1112:
module machine type 'X86' conflicts with target machine type 'x64'
on my x64-based machine with Win7_64bit, MATLAB2014a_64bit and Microsoft Visual Studio 2012 . Any advice here, please? I am trying to solve this for days and slowly runing out of time, hence I will appreciate any help a lot.
Martin

サインイン to comment.



Translated by