Help Please! matlab and c++ ,problem :forrtl: error (200): program aborting due to windows-CLOSE event

5 Ansichten (letzte 30 Tage)
Dear sir or madam,
I am using matlab R2012a to write future trade strategy, later complied the m file into .h,.Dll,*.lib; finally link this library at a c++ win32 console program.
I am comfirm that the c++ code and matlab strategy is free of error while they run indipendently.
The whole trade program run well except that whenever I click the Close button at the top right corner of the console form:
unexpected breakpoint was trigger and the program can't terminate normally.
Here's the details illustrations: ----------------------------------------------------------------------------------------------------------
1) main function code segment:
int _tmain(int argc, _TCHAR* argv[]) {
//<<<--------------------Begin Initialization------------------>>>>
......
if(!libsen_tradeInitialize())
{
std::cout <<"------------------》》》》Could not initialize StrategyLib《《《《-----------------------!" << std::endl;
getchar();
return -1;
}
//<<<--------------------Release Resource .......
// terminate MCR
libsen_tradeTerminate();
mclTerminateApplication();
return 0;
}
--------------------------------------------------------------------------------------------------------
after serveral day's testing, finally, I find that whenever I comment out the code block:
/*
if(!libsen_tradeInitialize())
{
std::cout <<"------------------》》》》Could not initialize StrategyLib《《《《-----------------------!" << std::endl;
getchar();
return -1;
}
*/
the program can exist normally.
I have found a post on :http://www.mathworks.com/matlabcentral/newsreader/view_thread/251203
but very sorry that can't exactly understand the solution:
do somebody ever encounter this problem? Please give me some suggestion !
Thank you very much!
Zhishang.

Antworten (0)

Kategorien

Mehr zu Call C++ from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by