R
rotarywing
Hi, guys
When I using Matlab engine in a c++ program, I encounter a
problem.
I hope someone could help me. It's urgent.
One simple cpp code can present my problem. My code as follows
//---------------------------------------------------//
// cpp_ma.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include "iostream.h"
#include "engine.h"
int main(int argc, char* argv[])
{
Engine *m_ep;
cout<<"&&&&&&&&&&&&& 001 &&&&&&&&&&&&&&&&&&"<<endl;
if (!(m_ep=engOpen("\0")))
{
cout<<"########### 002 ###########"<<endl;
fprintf(stderr,"\n Can't start MATLAB engine\n");
exit(-1);
}
cout<<"########### 003 ###########"<<endl;
engClose(m_ep);
return 0;
}
//---------------------------------------------------//
I use MS Visual C++ 6.0 to build this code. Under the debug mode,
compling and
building are OK, but when runing the program, error came out and it
said " Unhandled
exception in cpp_ma.exe: 0xc0000005:access violation." Under the
release mode,
compling is OK, but when building, below mesage poped out
//----------------------------------------------------//
--------------------Configuration: cpp_ma - Win32
Release--------------------
Linking...
LINK : warning LNK4089: all references to "0.obj" discarded by /OPT:REF
LINK : warning LNK4089: all references to "1.obj" discarded by /OPT:REF
LINK : warning LNK4089: all references to "14.obj" discarded by
/OPT:REF
LINK : warning LNK4089: all references to "20.obj" discarded by
/OPT:REF
cpp_ma.exe - 0 error(s), 4 warning(s)
//----------------------------------------------------//
When runing the exe, there is a error, it said memory 0x00905a4d
can't read .
I really don't know what happened to my code, I have added "
libeng.lib libmx.lib libut.lib " to
the Object/library modules( Project->settings->link->general) and the
relevant paths
also added to the Tools->Options->Directories.
Please help me if you have any idea about this. I would appreciate it
sincerely
Thanks in advance.
Best regard.
rotor
When I using Matlab engine in a c++ program, I encounter a
problem.
I hope someone could help me. It's urgent.
One simple cpp code can present my problem. My code as follows
//---------------------------------------------------//
// cpp_ma.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include "iostream.h"
#include "engine.h"
int main(int argc, char* argv[])
{
Engine *m_ep;
cout<<"&&&&&&&&&&&&& 001 &&&&&&&&&&&&&&&&&&"<<endl;
if (!(m_ep=engOpen("\0")))
{
cout<<"########### 002 ###########"<<endl;
fprintf(stderr,"\n Can't start MATLAB engine\n");
exit(-1);
}
cout<<"########### 003 ###########"<<endl;
engClose(m_ep);
return 0;
}
//---------------------------------------------------//
I use MS Visual C++ 6.0 to build this code. Under the debug mode,
compling and
building are OK, but when runing the program, error came out and it
said " Unhandled
exception in cpp_ma.exe: 0xc0000005:access violation." Under the
release mode,
compling is OK, but when building, below mesage poped out
//----------------------------------------------------//
--------------------Configuration: cpp_ma - Win32
Release--------------------
Linking...
LINK : warning LNK4089: all references to "0.obj" discarded by /OPT:REF
LINK : warning LNK4089: all references to "1.obj" discarded by /OPT:REF
LINK : warning LNK4089: all references to "14.obj" discarded by
/OPT:REF
LINK : warning LNK4089: all references to "20.obj" discarded by
/OPT:REF
cpp_ma.exe - 0 error(s), 4 warning(s)
//----------------------------------------------------//
When runing the exe, there is a error, it said memory 0x00905a4d
can't read .
I really don't know what happened to my code, I have added "
libeng.lib libmx.lib libut.lib " to
the Object/library modules( Project->settings->link->general) and the
relevant paths
also added to the Tools->Options->Directories.
Please help me if you have any idea about this. I would appreciate it
sincerely
Thanks in advance.
Best regard.
rotor