'mcc' command complains about "invalid directory" with R2022a
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to use the 'mcc command to compile a matalb file into a standalone application on 2022a linux version.
The command is as follows
mcc('-m',filename1, '-d', compileDir);
But I get an error saying "Invalid directory: /folder1/filename1.m/filename2.m" this error makes sense because my folder structure is as follows
folder1
filename1.m
filename2.m
My filename1.m uses a call to another function filename2.m but both of them are in the same folder1 as shown above.
How do I make my mcc command work so that it does not look for filename2.m under folder1/filename1.m/filename2.m but instead looks for filename2.m inside the same folder1 where filename1.m is located.
댓글 수: 0
답변 (1개)
Image Analyst
2023년 1월 27일
Since you did not specify a folder for filename1.m and filename2.m, it will look in the current folder, which of course will exists. If those files are in the current folder, that will not throw an error.
So the next place to look is at compileDir, which is the folder where you want the compiled executable to be saved to after the compilation has completed successfully. And that is where we're seeing the problem. The folder almost certainly should not be "/folder1/filename1.m/filename2.m".
Somehow when you constructed the compileDir variable, you made it incorrectly. Somehow the filenames got in there instead of just the folder alone. So of course that folder does not exist. Take a look again at how you create compileDir. It should be something like
compileDir = '/folder/Compiled Output';
if ~isfolder(compileDir)
warningMessage = sprintf('Note: "%s" does not exist yet.\nI will create that folder now.', compileDir);
buttonText = questdlg(warningMessage, 'Continue?', 'OK - Continue', 'Quit', 'OK - Continue');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(buttonText, 'Quit')
return;
else
mkdir(compileDir);
end
end
or something like that.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!