'mcc' command complains about "invalid directory" with R2022a
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposte (1)
  Image Analyst
      
      
 il 27 Gen 2023
        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 Commenti
Vedere anche
Categorie
				Scopri di più su MATLAB Compiler in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

