Compiling large nested folder structure
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesc Massanes Basi
el 11 de Sept. de 2020
Comentada: Image Analyst
el 11 de Sept. de 2020
Hello,
I am having an issue when compiling a large and deep structure where some of the m files on nested folders do not get added.
Example:
Structre:
a/file1.m
b/file2.m
b/A/file3.m
b/B/file4.m
b/B/x/file5.m
b/B/y/file6.m
b/B/z/file7.m
b/C/file8.m
b/D/file9.m
c/file10.m
d/file11.m
e/file12.m
Compilation:
mcc -o test.exe -W WinMain:file1.m -T link:exe -v a/file1.m -a ./*.m
Error:
When the binary is then executed, is missing the nested *.m files file5.m, file6.m, file7.m
Is there any solution to this?
0 comentarios
Respuestas (2)
Mohammad Sami
el 11 de Sept. de 2020
You need to add the folder and sub folders to the path before compiling. Example add folder b and all its sub folders to the path. addpath(genpath('b'));
Image Analyst
el 11 de Sept. de 2020
If file1.m is your main file, and it's in folder "a", then make "a" your current folder and do
mcc file1.m -o test.exe -W WinMain:file1.m -T link:exe -v
You don't need to explicitly list all the dependent m-files. The compiler will find them automatically, just as MATLAB did when you ran the file1.m file in the development environment because they are on your search path.
I'm not sure what the -W and -T options are - you may not need them. I never use them.
3 comentarios
Mohammad Sami
el 11 de Sept. de 2020
Yes as mentioned you need to add all folders and subfolder to the path, so that compiler can find all the files.
Image Analyst
el 11 de Sept. de 2020
If they're not on the path, then how does your main file even run at all? The other 11 files are in different folders, so if they were not on the path, your main program would not run. So somehow they were on the path when your file1.m program ran. Why were they not on the path when you ran the mcc command? Did your file1 program call addpath()? If so, that will throw a warning during compile.
Ver también
Categorías
Más información sobre MATLAB Compiler en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!