如何使用Boost库构建MEX函数?

时间:2019-01-01 17:03:25

标签: c++ matlab boost

我正在尝试使用Boost库来编写多线程MEX函数。我已经安装了Boost库,并使用Visual Studios对它们进行了测试。我编写了以下MEX函数,并尝试在MATLAB控制台中进行构建:

In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[15.0.1], but play-services-basement version was 16.0.1.

The following dependencies are project dependencies that are direct or have 
transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto io.kommunicate:kommunicate@1.6.3
-- Project 'app' depends onto com.google.android.gms:play-services-auth@16.0.1

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your build.gradle file.

这是输出

#include "mex.h"
#include <boost/filesystem.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
#include <boost/atomic.hpp>

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{

}

现在我已经将Boost库文件添加到MATLAB PATH中,如下所示:

>> mex simpleBoostExample.cpp -IC:\Folder\OtherFolder\MATLAB\Files\boost\boost_1_67_0
Building with 'Microsoft Visual C++ 2017'.
Error using mex
LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc141-mt-x64-1_67.lib'

所以我不确定我缺少什么。

1 个答案:

答案 0 :(得分:2)

使用-L-l在(可选) libfolder 中与动态对象库 libname 链接。

  

-LC:\ Folder \ OtherFolder \ MATLAB \ Files \ boost \ boost_1_67_0 -llibboost_filesystem-vc141-mt-x64-1_67.lib