Trying to setup MinGW 4.9.2 for mex

3 views (last 30 days)
Christopher  Davis
Christopher Davis on 22 Jan 2016
Commented: Walter Roberson on 29 Jan 2016
Ok, so I would like to incorporate some C code using mex, so I set about installing MinGW from TDM using the add-on provided by matlab. Every time I tried to install, I got an error saying I have the wrong version of mingw installed (which is ridiculous because I used the package downloaded from matlab, and yes, I unchecked the don't look for updates box). So I dug around in the script that checks the version I have installed. It's called mexSetupMinGW.m It runs fine up until line 136 when calling
[~, cmdout] = system([path_to_gcc , ' --version']);
cmdout is returned as an empty string, however when I type
C:\TDM-GCC-64\bin\gcc.exe --version
(the string sent to system() by [path_to_gcc , ' --version']) into command prompt I get this:
C:\>C:\TDM-GCC-64\bin\gcc.exe --version
gcc.exe (tdm64-1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So the gcc.exe is there and it is the correct version, but something is going wrong on line 136 of mexSetupMinGW.m and I haven't the slightest idea of what to try next. Except maybe to manually set cmdout as the output I got from command prompt.
Anyone out there have any ideas?
edit:
Yep. I set cmdout = 'gcc.exe (tdm64-1) 4.9.2'; right under line 136 and the script executed properly. I then ran mex -setup and mingw64 popped up. That doesn't explain why system() was returning an empty string though...
  3 Comments
Walter Roberson
Walter Roberson on 29 Jan 2016
You appear to have a conflict of runtime libraries. This is the sort of thing you would use Dependency Walker to trace down.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!