Error: "error: ld returned 1 exit status " during the deploy to hardware in Tiva C

1 次查看(过去 30 天)
Hello,
I'm learning how to use C code in the Simulink function block to be applied in my Tiva C launchpad. If i test the link in the simulation all works fine, the error appears when I try to deploy to the launchpad.
These are the codes:
Doblez.C Code:
#include <stdio.h>
#include "dobloh.h"
double u;
int main() {
return 0;
}
double doble(double u){
double car;
car=2*u;
return car;
}
dobloh.Header:
#ifndef DOBLADOR_C_
#define DOBLADOR_C_
double doble(double u);
#endif /* DOBLADOR_C_ */
Simulink blocks:
Matlab function block code:
function y = callingDoblez(u)
%#codegen
y=0.0;
y = coder.ceval('doble',u);
Error Message:
MW_EnergiaTivaHWInit.o MW_EnergiaTimerInit.o io_wrappers.o Energia_main.o arm_cortex_m_multitasking.o ert_main.o -lm
ert_main.o: In function `main':
C:\\Users\\Alberto\\Desktop\\untitled_ert_rtw/ert_main.c:39: multiple definition of `main'
doblez.o:C:\\Users\\Alberto\\Desktop\\untitled_ert_rtw/../doblez.c:7: first defined here
collect2.exe: error: ld returned 1 exit status
gmake: *** [../untitled.elf] Error 1
### Creating HTML report file untitled_codegen_rpt.html
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.
I hope you can help me to understand the error, because I can't find any solution.
Thanks
Regards Alberto

采纳的回答

Walter Roberson
Walter Roberson 2016-4-17
Remove your lines that say
int main() {
return 0;
}
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Run on Target Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by