Matlab will not compile my C++ .exe file

2 views (last 30 days)
Mini Me
Mini Me on 21 Jan 2013
I have program in C++ that runs great but it has different steps in it. It opens a file first then does some calculations based on the data it gets from the file. Now I'm trying to run it through matlab. I tried mex but it got too complicated because I have VS 2010 Express and MATLAB 2007b. And so mex can never find my c compiler.
I'm now trying to just run it straight from the C++ program executable file through matlab. Here's how I tried to do it:
it would act like it's compiling the command line window for the executable file does not come up and matlab command window freezes and I have to close Matlab every time to get back on track. So I wrote a sample code to open the file first before the system command open the .exe file. I've done something like M=fopen('fname','r'), but nothing works. Please note that this file I'm trying to open is a .COF file that the program uses to do calculations.
I tried running the .exe file using debug and release modes but nothing happens. It gives no errors which means it sees the .exe file but the command line doesn't come up and matlab command window freezes everytime
After running, it's supposed to prompt the user at the command line input then take input arguments and output results... I do not want to use MEX but if you have a simper way to get the C++ .exe to run through matlab i am opened to it.
Please help....
P.S im using VS 2010, MATLAB R2007b and MAtlab r2011a,Win7, 32 and 64 bit.

Answers (2)

Walter Roberson
Walter Roberson on 21 Jan 2013
VS 2010 Express is not supported for R2007b. Use VS 2005. See
Jan on 24 Jan 2013
It acts like it is compiling? Are there any arguments or observations which for this claim? An EXE-file is compiled already, and as long as this EXE is not a compiler itself I do not see any reasons for your assumption. It is more likely that your program hangs due to a bug. Can you exclude that?

Sign in to comment.

Ryan Livingston
Ryan Livingston on 24 Jan 2013
I would recommend trying the '-echo' option to SYSTEM. From the doc:
[status,cmdout] = system(command,'-echo')
additionally displays (echoes) the command output in the MATLAB® Command Window. This syntax is most useful for commands that require user input and that run correctly in the MATLAB Command Window.
Sometimes window output can not happen immediately. Also, if your program tries to redirect any of the streams like STDIN, STDOUT then issues could arise.


Community Treasure Hunt

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

Start Hunting!