本文介绍了如何解决LibQP编译Matlab Mex文件错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在Matlab中使用Libqp(LAGARY FOR QUADRATIC PROGRAMMING)来完成我的项目。我在Windows 7 64位,Matlab R2011b上运行代码。我已经下载了库,当我想根据简单的结构进行编辑时:
运行Matlab并转到文件夹libqp_root / matlab
cd libqp_root / matlab
运行编译mex文件
libqp_compile
我收到以下错误:
I need to use Libqp (LIBRARY FOR QUADRATIC PROGRAMMING) for my project in Matlab. I am running the code on Windows 7 64 bit, Matlab R2011b. I have downloaded the library and when I want to comiple it according to the simple inctructions:
Run Matlab and go to the folder libqp_root/matlab
cd libqp_root/matlab
Compile mex files by running
libqp_compile
I get the following errors:
libqp_gsmo_mex.c
libqp_gsmo_mex.c(75) : warning C4267: '=' : conversion from 'size_t' to 'uint32_t', possible loss of data
libqp_gsmo_mex.c(107) : error C2275: 'libqp_state_T' : illegal use of this type as an expression
C:/Users/Downloads/libqp/lib/libqp.h(54) : see declaration of 'libqp_state_T'
libqp_gsmo_mex.c(107) : error C2146: syntax error : missing ';' before identifier 'state'
libqp_gsmo_mex.c(107) : error C2065: 'state' : undeclared identifier
libqp_gsmo_mex.c(108) : error C2065: 'state' : undeclared identifier
libqp_gsmo_mex.c(109) : error C2440: '=' : cannot convert from 'libqp_state_T' to 'int'
libqp_gsmo_mex.c(115) : error C2065: 'state' : undeclared identifier
libqp_gsmo_mex.c(115) : error C2224: left of '.QP' must have struct/union type
libqp_gsmo_mex.c(115) : error C2198: 'mxCreateDoubleScalar' : too few arguments for call
libqp_gsmo_mex.c(116) : error C2065: 'state' : undeclared identifier
libqp_gsmo_mex.c(116) : error C2224: left of '.exitflag' must have struct/union type
libqp_gsmo_mex.c(116) : error C2198: 'mxCreateDoubleScalar' : too few arguments for call
libqp_gsmo_mex.c(117) : error C2065: 'state' : undeclared identifier
libqp_gsmo_mex.c(117) : error C2224: left of '.nIter' must have struct/union type
libqp_gsmo_mex.c(117) : error C2198: 'mxCreateDoubleScalar' : too few arguments for call
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'libqp_gsmo_mex.c' failed.
任何指针都赞赏。
Any pointers appreciated.
推荐答案
Hey,
I have found a solution. I have tried to compile them in matlab too but no success. So i decided to compile them on Visual Studio 2010.
I came up a solution on StackOverFlow that explains how to compile MEX files on Visual Studio <a href="http://stackoverflow.com/a/16718578">LINK</a>. I followed the steps and compiled both MEX files.
libqp_splx_mex.c easily compiled but my compiler produced strange errors when i tried to compile libqp_gsmo_mex.c file but when i move "libqp_state_T state;" declaration to top it resolved.
I hope it helps.
这篇关于如何解决LibQP编译Matlab Mex文件错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!