error using mex with external library with extra qualifiers

Hello,
I am trying to compile a mex function with an external .cpp library which has extra qualifiers. How can I call the functions from external library that has extra qualifiers?
If I don't add the qualifier the error is:
C:\Users\rdeshpande\DS10ep_workspace\MatlabProspectra\mfiles\cprogram\CallMathLib.cpp:29:47: error: 'Add' was not declared in this scope
plhs[0] =mxCreateDoubleScalar (Add(no1,no2));
If I add the extra qualifier in this call
plhs[0] =mxCreateDoubleScalar (MathLibrary::Functions::Add(no1,no2));
The error is: Building with 'MinGW64 Compiler (C++)'. Error using mex C:\Users\RDESHP~1\AppData\Local\Temp\mex_245413811332369_15808\CallMathLib.obj:CallMathLib.cpp:(.text+0xab): undefined reference to `__imp__ZN11MathLibrary9Functions3AddEdd' collect2.exe: error: ld returned 1 exit status

2 commentaires

What is the mex command you are using? How are you linking in the MathLibrary?
The mex command I am using is :
mex CallMathLib.cpp MathLibrary.lib
In MathLibrary.h:
namespace MathLibrary
{
// This class is exported from the MathLibrary.dll
class Functions
{
public:
// Returns a + b
static MATHLIBRARY_API double Add(double a, double b);
};
}

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by