Runtime errors in compiled standalone
显示 更早的评论
Hi! I'm trying to figure out why my compiled standalone app, whose source runs fine within Matlab, is crashing. First I was getting the "File not found" error, despite the fact that the file it couldn't find is in the very same directory as the "main" file. So I went ahead and explicitly included the file in the project; that got me past that File not found error, but the log file my program generates indicates theat the program kept throwing an "Unable to checkout a license for" error...when it gets to one of my files! (Though the path it gave for it--it's the same file each time, a classdef m file that gets called inside a loop--seems somewhat suspect: it's finding it under C:\Users\dgol461\AppData\Local\Temp\dgol461\mcrCache7.16\Proces16\). And when it gets to my closing "clean-up" routine, it again crashes w/ the File not found error, again despite the presence of the unfound file in the same directory as the main.
Please help; thanks!
回答(5 个)
Image Analyst
2013-1-14
编辑:Image Analyst
2013-1-14
0 个投票
10 个评论
David Goldsmith
2013-1-14
编辑:David Goldsmith
2013-1-14
Image Analyst
2013-1-14
编辑:Image Analyst
2013-1-14
The compile process will find any needed .m files but not other files such as DLLs, documentation, mat files, Excel workbooks, splash images, data files, etc.
Look into the license() command. For example:
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
It has various codes that tell you if you don't have the license or if you have a floating license but all copies of it are in use at the moment.
David Goldsmith
2013-1-14
编辑:David Goldsmith
2013-1-14
Image Analyst
2013-1-14
That doesn't make sense. It should never complain about not finding an m-file. Did it make an "excluded files.log" file or something like that? What's in it? Also, please provide all of the stuff spewed out to the console window when you run your program. Open a console window and run it from the OS prompt if you have to (to get the error message to stay there and not vanish). Lastly, you can call the Mathworks and ask them.
David Goldsmith
2013-1-15
Image Analyst
2013-1-15
Sometimes you do have to include an m-file in the mcc line (I found out today) - when you are calling a DLL because you can't use the h file like you can in the development environment, you have to create a "prototype" file, which is an m-file and it won't get found unless you explicitly include it with the -a option of mcc. Anyway it sounds like you have that part solved.
For the remaining license check out issue. You aren't by chance running this on a multi-user system under a different account are you? Can you install the MCR and exe on your system and run it? Does it work fine there, and is it just on the target system where it complains about the license? Or does it make the same complaint on both systems?
David Goldsmith
2013-1-15
Image Analyst
2013-1-16
编辑:Image Analyst
2013-1-16
I'm surprised that you would get that kind of error message. Usually you get a message something like "You need to have MCR version 7.13 installed" instead. I'm really puzzled sure why you didn't get that. But the MCR installed on the target machine must match that you used to compile it with. You can find the proper MCR on your computer in the C:\Program Files\MATLAB\R2012b\toolbox\compiler\deploy\win64 (or similar) folder. I believe all the current and past MCRs are also available on the Mathworks web site.
Walter Roberson
2013-1-16
Only R2012a and R2012b MCRs are available for download, as far as I have heard.
David Goldsmith
2013-1-16
Walter Roberson
2013-1-15
编辑:Walter Roberson
2013-1-15
0 个投票
A couple of possibilities:
Question: is your code changing directories? Is the MATLAB path what you expect when the problem occurs?
David Goldsmith
2013-1-17
0 个投票
4 个评论
Image Analyst
2013-1-17
How exactly did you tell the compiler to use the local or network version of the files? It goes through the search path to determine which dependent m-file(s) to use. Did you adjust the path?
David Goldsmith
2013-1-17
Image Analyst
2013-1-17
I'm not sure I trust that. Sure it may include that file on the the network disk, but when it comes time to actually call the function it will see two versions of it - the network one and the one in the same folder. Then it has to decide which one to call. So even though you included that file, it may not be the one it calls. I'd put in a message box to verify,
uiwait(msgbox('Calling network file'));
or
uiwait(helpdlg('Calling local file'));
Then see if the network one is actually the one being used. Anyway, the compiler is a very expensive toolbox. Make sure you get your money's worth and call tech support. Can you do that? Did you buy it within the last year or are current on your maintenance contract?
David Goldsmith
2013-1-17
类别
在 帮助中心 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!