使用cygwin从c ++调用matlab

时间:2012-11-30 14:08:16

标签: c++ windows matlab makefile cygwin

我正在使用Windows,并希望将数据从C ++发送到Matlab。我已经得到了这样做的印象,最容易创建一个makefile。因此我安装了cygwin来使用make命令。

我的makefile如下:

CXX = g++
CFLAGS = -O3 -I /cygdrive/c/Program\ Files/MATLAB/R2011a/extern/include
LIBS = -L /cygdrive/c/Program\ Files/MATLAB/R2011a/extern/lib/win64/microsoft/
LIBS2 = -L /cygdrive/c/Program\ Files/MATLAB/R2011a/extern/lib/win64/microsoft/libmx.lib
LDFLAGS = -leng -lmx

RKspace2d: RKspace2d.o
    $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)

RKspace2d.o: RKspace2d.cpp
    $(CXX) -c $(CFLAGS) $(LIBS) $<
# $@ name of the target
# $^ name of all prerequisites with duplicates removed
# $< name of the first prerequisite

当我在cygwin终端输入“make”时,如果在正确的目录中,我会收到以下错误:

$ make
g++ -o RKspace2d RKspace2d.o -leng -lmx -L /cygdrive/c/Program\ Files/MATLAB/R2011a/extern/lib/win64/microsoft/
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -leng
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lmx
collect2: ld returnerede afslutningskoden 1
makefile:8: recipe for target `RKspace2d' failed
make: *** [RKspace2d] Error 1

我相信路径是正确的,因为libeng.lib和libmx.lib都包含在microsoft文件夹中。

希望你们能提供帮助 托马斯

0 个答案:

没有答案