Mex_function Unicode.lib
조회 수: 8 (최근 30일)
이전 댓글 표시
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
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
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
2018년 12월 6일
댓글 수: 1
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 Center 및 File 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!