我想编写一个的CMakeLists.txt
这样的CMake写一个Visual Studio 2010(64位)解决方案文件建立一个MEX功能MATLAB R2011a(64位)从C + + code example.cxx
。
I would like to write a CMakeLists.txt
such that CMake writes a Visual Studio 2010 (64 bit) solution file to build a mex function for MATLAB R2011a (64 bit) from C++ code example.cxx
.
MEX
,但设置了Visual Studio解决方案文件,这样的Visual C ++链接相关的MATLAB库。
example.cxx
有除了MATLAB库所必需的MEX文件没有依赖关系。
的CMake 2.8.7设置正确,这样它采用了64位发生器的Visual Studio 2010。
I do not want to use MATLAB's compiler wrapper mex
but set up the Visual Studio solution file such that Visual C++ links the relevant MATLAB libraries.
example.cxx
has no dependencies except for the MATLAB libraries that are necessary for mex files.
CMake 2.8.7 is set up correctly such that it uses the 64 bit generator for Visual Studio 2010.
什么,我现在做的实质是
The essence of what I am doing right now is
find_package(Matlab)
add_library(example STATIC example.cxx)
target_link_libraries(example ${MATLAB_LIBRARIES})
无论是编译器和链接器发出任何错误。我安装的输出 example.lib
下在MATLAB的路径的目录名称 example.mexw64
。当我打电话例如
从MATLAB,我得到错误信息
Neither the compiler nor the linker issues any errors. I install the output example.lib
under the name example.mexw64
in a directory in MATLAB's path. When I call example
from MATLAB, I get the error message
??? Invalid MEX-file
'C:\...\example.mexw64':
C:\...\example.mexw64 is not a valid Win32 application.
任何建议,欢迎!
Any suggestions are welcome!
我有rel="nofollow">这个链接同样的问题,