javaaddpath error from c++ shared library
5 次查看(过去 30 天)
显示 更早的评论
Hello! I created simple function in MATLAB (the name of the func is meshgridC because before it did just meshgrid and when I changed it I forgot to change the name :P)
function meshgridC(vecX,vecY)
plot(vecX,vecY);
end
So I compiled it to C++ shared library and linked it to Visual Studio 2017.
#include "stdafx.h"
#include "meshgridC.h"
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmex.lib")
#pragma comment(lib, "libeng.lib")
#pragma comment(lib, "meshgridC.lib")
#pragma comment(lib, "mclmcrrt.lib")
int main()
{
const int size = 100;
double x[size] = { 0 };
double y[size] = { 0 };
for (int i = 1; i <= 99; i++)
{
x[i] = x[i - 1] + 0.01;
y[i] = x[i] * x[i];
}
if (!mclInitializeApplication(NULL, 0))
{
fprintf(stderr, "An error occurred while initializing: \n %s ", mclGetLastErrorMessage());
return -1;
}
// Initialize the Vigenere library
if (!meshgridCInitialize())
{
std::cerr << "Could not initialize the library properly."
<< std::endl;
return -1;
}
mwArray rX, rY;
mwArray vecX, vecY;
vecX = x;
vecY = y;
meshgridC(vecX, vecY);
meshgridCTerminate();
mclTerminateApplication();
}
When the program gets to the meshgridCInitialize() function, it fails. It is writing me:
Undefined function or variable 'javaaddpath'
Could not initialize the library properly.
If I run it from debug, on mclInitializeApplication(NULL, 0) statement, Visual Studio writes me:
Frame not in module
The current stack frame was not found in a loaded module.
Source cannot be shown for this location.
00000266E9D103B4 mov eax,dword ptr [rsi]
How can I fix it? Thanks!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Compiler SDK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!