Error: "error: ld returned 1 exit status " during the deploy to hardware in Tiva C
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!