Building mym on 64-bit Windows 7

3 次查看(过去 30 天)
Has anyone been able to get mym ( http://sourceforge.net/projects/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 7.13.0.564 (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 ( http://www.zlib.net/ ), 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. Any suggestions would be greatly, and I mean greatly, appreciated.
Thanks, Bill

采纳的回答

William
William 2012-9-20
Finally got this stupid ** to work. Add COMPFLAGS="$COMPFLAGS /MT" to your command. So it should look something like:
mex -v COMPFLAGS="$COMPFLAGS /MT" -I"C:\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
Or, in my case:
mex -v COMPFLAGS="$COMPFLAGS /MT" -I"C:\Program Files\MySQL\MySQL Server 5.5\include" -I"C:\Program Files\zlib-1.2.7" -L"C:\Program Files\MySQL\MySQL Server 5.5\lib" -L"C:\Program Files\zlib-1.2.7" -lz -lmysqlclient mym.cpp

更多回答(2 个)

Karl
Karl 2012-9-20
Thanks, this was very helpful!
A couple notes:
- I had to use '-lzlib' instead of '-lz'
- Here's a discussion of the /MT switch (it causes your app to use static version of runtime library) http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.100).aspx
- I had to build zlib from source. Here's how
  1. Download from here: http://zlib.net/zlib127.zip
  2. Start...All Programs...Microsoft Visual Studio 2010...Visual Studio Tools...Visual Studio 2010 Command Prompt
  3. Wait for several minutes till it finishes updating environment.
  4. cd C:\zlib-1.2.7
  5. nmake -f win32/Makefile.msc

Matthias
Matthias 2017-8-1
Thanks. I got it to work, but had to remove the
COMPFLAGS="$COMPFLAGS /MT"
So the overall command:
mex -v -I"C:\Program Files\MySQL\MySQL Server 5.7\include" -I"T:\zlib-1.2.11" -L"C:\Program Files\MySQL\MySQL Server 5.7\lib" -L"T:\zlib-1.2.11" -lzlib -lmysqlclient mym.cpp

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by