Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Has anyone been able to get mym ( to build on a 64-bit Win7 machine? And if so would you mind posting or linking your steps to do so?

My particulars: Windows 7 Enterprise, 64-bit OS MATLAB Version (R2011b) Microsoft VS 2010 Ver. 10.0.30319.1 MySQL Ver 14.14 Distrib 5.5.21, for Win64 (x86)

I ran "mex -setup" and I was able to compile and run "yprime.c"

I downloaded and installed zlib (, which is what the readme file for mym says to do.

Here is the mex command that I am using:

mex -IC:\zlib-1.2.6 -I'C:\Program Files\MySQL\Connector C 6.0.2\include' ...
      -L'C:\Program Files\MySQL\Connector C 6.0.2\lib\opt' ...
      -L'C:\zlib-1.2.6' -lzlib -lmysqlclient mym.cpp

I get a bunch of "already defined in MSVCRT.lib" error messages. e.g.:

LIBCMT.lib(tidtable.obj) : error LNK2005: _encoded_null already defined in MSVCRT.lib(MSVCR100.dll) 
LIBCMT.lib(invarg.obj) : error LNK2005: _set_invalid_parameter_handler already defined in MSVCRT.lib(MSVCR100.dll) 
LIBCMT.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR100.dll)

I admit that I'm stumped at this point and there is not a whole lot of helpful info out there on the world wide web.


From my notes, here are the steps that I took to get this to work (Note: I'm no longer working on the project that needed this so I hope things haven't changed since I did this)

  1. Install 32-bit MATLAB if not already available. (I believe mym requires 32-bitbit MATLAB though I am not 100% sure about this.)
  2. Download zlib source code ( The version that I downloaded was 1.2.6; the source was contained in a zip archive called
  3. Unzip the zlib source code and place in desired location—I placed contents in folder “C:\zlib 1.2.6”
  4. Download ( (NOTE: After building zlib while writing these notes, I noticed that there is a available.)
  5. Copy the contents of the directory “contrib\masmx86” in the zip archive to the directory “...\zlib 1.2.6\contrib\masmx86” directory (NOTE: This step was necessary because when I tried to build zlib I got an error message regarding missing files. I don’t remember how or where I found the solution to this. I forgot to note the web site. I found the link listed in step 4 while writing these notes.)
  6. Build zlib with Microsoft Visual Studio 2010: a. Double-click file the MVS solution file, zlibvc.sln, in folder “...\zlib 1.2.6\contrib\vstudio\vc10\” to start MVS2010. (NOTE: When I did this I got six projects listed under solution zlibvc.) b. Build the project. (NOTE: When I did this, only project zlibvc built successfully but that was the only one I needed. Also, I set the project properties so that the Configuration was a Release build instead of a Debug build.) c. Verify that zlibwapi.lib is generated in the folder “...\zlib 1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease”.
  7. Download mym ( The version that I installed was 1.36. The source was contained in a zip archive called
  8. Unzip the mym archive and place the contents in desired location—I placed contents in folder C:\Users\dossow1\Documents\MATLAB\mym_src_v1.36
  9. Copy the file msvc100opts.bat from the directory “C:\Program Files (x86)\MATLAB\R2011b\bin\win32\mexopts” to the directory where mym was stored.
  10. Edit the msvc100opts.bat file to add option “/NODEFAULTLIB:LIBCMTD” to the “set LINKFLAGS” line.
  11. Start MATLAB, cd to the directory where mym was stored, and compile mym with the following command:

mex -f .\msvc100opts.bat -I'C:\zlib-1.2.6' -I'C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include' ... -L'C:\zlib-1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease' ... -L'C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt' ... -llibmysql -lzlibwapi .\mym.cpp

  1. Do one of the following: a. Copy the following DLL’s to the directory where mym is stored: i. zlibwapi.dll from “...\zlib-1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease” ii. libmysql.dll from “...\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt” b. Add the directories where zlibwapi.dll and libmysql.dll are located to the system path (via Control Panel| Advanced System Properties | Environment Variables | System Variables | Path)

Now mym should be ready to run!!

share|improve this question
You will need to make sure every library ( including zlib ) is built to support 64-bit otherwise built everything as a x86 assembly and install the 32 version of MatLab, MySQL, ect. – Ramhound Apr 11 '12 at 14:19
I'm getting closer ... After some research with Mr. Google I added /NODEFAULTLIB:LIBCMTD to the "set LINKFLAGS" line in the mexopts file Matlab is using (in my case MSVC100OPTS.BAT). That got rid of the "already defined" errors. Now I'm left with a handful of "unresolved external symbol" errors in mysqlclient.lib(my_init.obj). BTW, Thanks for the response Ramhound. – Bill Doss Apr 11 '12 at 14:39
Could you indicate whether the question is still open? Or if you have found the answer please post it for future reference. – Dennis Jaheruddin Jan 14 '13 at 15:09
I did eventually get this to work, I'll list the steps above because they are too long to fit here. – Bill Doss Jan 17 '13 at 15:44

You must log in to answer this question.

Browse other questions tagged .