Compiling large nested folder structure

9 ビュー (過去 30 日間)
Francesc Massanes Basi
Francesc Massanes Basi 2020 年 9 月 11 日
コメント済み: Image Analyst 2020 年 9 月 11 日
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?

回答 (2 件)

Mohammad Sami
Mohammad Sami 2020 年 9 月 11 日
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'));
  1 件のコメント
Francesc Massanes Basi
Francesc Massanes Basi 2020 年 9 月 11 日
That is a good answer, but only if you are running it from inside of matlab, if you are compiling from command line, this does not work.

サインインしてコメントする。


Image Analyst
Image Analyst 2020 年 9 月 11 日
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 件のコメント
Mohammad Sami
Mohammad Sami 2020 年 9 月 11 日
Yes as mentioned you need to add all folders and subfolder to the path, so that compiler can find all the files.
Image Analyst
Image Analyst 2020 年 9 月 11 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by