Matlab Coder not working

2 ビュー (過去 30 日間)
chef13
chef13 2013 年 7 月 29 日
Hi to everyone,
I have this function:
function output = simplecontroller(input)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%Input
% f0=0;
% flag=f0;
L=input(1);
V=input(2);
Ldot=input(3);
% Vdot=input(4);
flag=input(4);
L0=0.28;
% flag0=0;
S1=0;
S2=1;
Ldot_thres=0;
Vin=2000;
V_thres=Vin;
if(flag==0) % Corresponds to phase X to A
S1=0;
S2=1;
if(Ldot<Ldot_thres && L>=L0*1.5)
S1=1;
S2=0;
flag=1;
end
elseif(flag==1) % Corresponds to phase A to B
S1=1;
S2=0;
if(V>=V_thres)
S1=0;
S2=0;
flag=2;
end
elseif(flag==2)
S1=0;
S2=0;
if(Ldot>=0 )
S2=1;
S1=0;
flag=0;
end
elseif(flag==3)
S2=1;
S1=0;
if(L<=L0+0.05)
flag=0;
end
else
flag=0;
disp('ERROR !!!!!!!!!!!!!!!!!!!!!')
end % end of the principal if statement
output=[S1;S2;flag];
end
This is a really easy code but my Build Log gives me this error:
1 ### Compiling simplecontroller_initialize.c ...
2 gcc -c -ansi -pedantic -fwrapv -fPIC -O0 -DMODEL=simplecontroller -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/media/sf_Desktop/Simulink/Simulink\ backup -I/media/sf_Desktop/Simulink/Simulink\ backup/codegen/lib/simplecontroller -I/media/sf_Desktop/Simulink/Simulink -I/media/sf_Desktop/Simulink/Simulink\ backup/backup -I/usr/local/matlab/R2013a/extern/include -I/usr/local/matlab/R2013a/simulink/include -I/usr/local/matlab/R2013a/rtw/c/src -I/usr/local/matlab/R2013a/rtw/c/src/ext_mode/common -I/usr/local/matlab/R2013a/rtw/c/ert -o "simplecontroller_initialize.o" "simplecontroller_initialize.c"
3 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1: /usr/local/matlab/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl_c.so.4)
4 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1: /usr/local/matlab/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl.so.12)
5 gmake: *** [simplecontroller_initialize.o] Error 1
6
7 ### Failed to generate all binary outputs.
Someone has an idea of what could be the error?
I defined the input as a vector 1x4 because at every iteration I have a 1x4 vector which goes as input to the function.
Is that correct?

採用された回答

chef13
chef13 2013 年 7 月 30 日
Thanks for your replies!

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 7 月 29 日
You have gcc 4.7 installed. You need gcc 3.4.15 instead (or as well.)

Ryan Livingston
Ryan Livingston 2013 年 7 月 29 日
The supported version of GCC for R2013a is 4.4.*:
The version of GLIBCXX is not necessarily the same as that of GCC:
The version of libstdc++.so is not recent enough on your system. I would suggest checking for newer versions of that package with the package manager on your distribution.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by