Mex_function Unicode.lib

1 次查看(过去 30 天)
Hareesh Kumar
Hareesh Kumar 2018-10-22
编辑: Jan 2018-12-6
i have a lib which includes uni coded headers, while mexing with lib headers i am getting lot of compiler errors which is basically unable to convert the arguments from one form to other
#include "SamplwUnicodeCPP.h"
using matlab::mex::ArgumentList;
using matlab::engine::convertUTF8StringToUTF16String;
using namespace matlab::data;
class MexFunction : public matlab::mex::Function
{
ArrayFactory factory;
std::shared_ptr<matlab::engine::MATLABEngine> matlabPtr = getEngine();
CSamplwUnicodeCPP *m_libptr;
public:
MexFunction::MexFunction(void)
{
}
void operator()(ArgumentList outputs, ArgumentList inputs)
{
m_libptr->Getstring();
}
};
and i am including corresponding headers and lib in a.m script
close all;
clc;
%addpath('include','lib')
addpath(genpath(pwd))
disp('Generating release code');
mex('-R2018a','-Iincludes','-Llib', 'Extract_data.cpp')
disp('Done');
i am pretty new to MATLAB, please help, where i am going wrong !!!
  3 个评论
Jan
Jan 2018-10-22
[MOVED from section for answers] Hareesh Kumar wrote:
Thank you Jan
Error using mex Creating library Extract_data.lib and object Extract_data.exp Extract_data.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl CSamplwUnicodeCPP::Getstring(void)" (?Getstring@CSamplwUnicodeCPP@@QEAA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ) referenced in function "public: virtual void __cdecl MexFunction::operator()(class matlab::mex::MexIORange<class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class matlab::data::Array> > > >,class matlab::mex::MexIORange<class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class matlab::data::Array> > > >)" (??RMexFunction@@UEAAXV?$MexIORange@V?$_Vector_iterator@V?$_Vector_val@U?$_Simple_types@VArray@data@matlab@@@std@@@std@@@std@@@mex@matlab@@0@Z) Extract_data.mexw64 : fatal error LNK1120: 1 unresolved externals
this is the error i am getting i placed all the lib and includes in same root folder
Jan
Jan 2018-10-22
You mention "Unicode.lib", but did not include it in the mex command, as far as I can see.

请先登录,再进行评论。

回答(1 个)

Hareesh Kumar
Hareesh Kumar 2018-12-6
hi can you please tell me how can i include an extrenal x64 release static lib in mexing
currently i am using a build .m script like this
close all;
clc;
%addpath('include','lib')
addpath(genpath(pwd))
disp('Generating release code');
mex('-R2018a','-Iinclude','-Llib/-lsampleunicode lib.lib',''Extract_data.cpp'')
disp('Done');
whre i copied all the include files in include folder and external static lib in lib folder
any thing else i would say the lib name?
please help
  1 个评论
Jan
Jan 2018-12-6
编辑:Jan 2018-12-6
This seems to be a new question. Please open a new thread instead of attaching it in the section for answers of another question.
There is no reason to pollute the path with the current folder in addpath(genpath(pwd)). Omit this line. Use absolute folder names instead.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Write C++ Functions Callable from MATLAB (MEX Files) 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by