I would like to compile a c++ file as a mex file in MATLAB namely: "mexLasso.cpp".
我想在MATLAB中編譯一個c++文件,即:“mexLasso.cpp”。
These are the steps I take and I get the following error. What is the problem?
這些是我采取的步驟,我得到了以下錯誤。這個問題是什么?
1. Put the files "mexLasso.cpp" and "mexutils.h" in a folder.
1。把文件“mexLasso。cpp”和“mexutils。h”文件夾中。
2. Set the compiler:
2。設置編譯器:
mex -setup C++
I recieve:
我接待:
MEX configured to use 'Microsoft Visual C++ 2013 Professional' for C++ language compilation.
3. Run the command:
3所示。運行以下命令:
mex C:\...\mexLasso.cpp
I recieve the following error:
我收到以下錯誤:
Error using mex
mexLasso.cpp
C:\...\mexLasso.cpp(33) : fatal error C1083: Cannot
open include file: 'mexutils.h': No such file or directory
Can somebody help us what we are missing?
有人能幫助我們嗎?
2 个解决方案
#1
1
From the mex command line tool reference, there is an argument for adding include paths:
在mex命令行工具引用中,有一個關於添加include路徑的參數:
-Ipathname Adds pathname to the list of folders to search for #include files.
Do not add a space between I and pathname.
-Ipathname將路徑名添加到要搜索#include文件的文件夾列表中。不要在我和路徑名之間添加空格。
Like this:
是這樣的:
mex -v -IC:\path\to\mexutils_h\ mexLasso.cpp
Note that with -I you are not specifying the header, you are specifying a path containing one or more header files.
請注意,如果您沒有指定header,那么您將指定包含一個或多個頭文件的路徑。
#2
0
Thanks for your comments. I think the besy way to solve my problem is to install SPAMS in my machine and successfully compile it. I have posted the steps I take in this post :
謝謝你的評論。我認為解決我的問題的方法是在我的機器上安裝SPAMS並成功地編譯它。我已經發布了我在這篇文章中所采取的步驟:
如何在windows8.1下的Matlab 2014b中安裝SPAMS工具箱?
Can I have your opinion there. Sorry for duplicated message, only for relevancy and importance of the discussed topic.
我能聽聽你的意見嗎?抱歉重復的信息,只是為了相關性和重要性的討論的話題。
Many thanks.
多謝。