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

4 ビュー (過去 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 件のコメント
Walter Roberson
Walter Roberson 2016 年 4 月 17 日
I do not know anything about CCS.
Alberto Prudhomme
Alberto Prudhomme 2016 年 4 月 18 日
Ok, thanks for your help

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by