Error S function builder class redefenition

조회 수: 2 (최근 30일)
Florian Soldner
Florian Soldner 2016년 7월 31일
댓글: Kurt Stewart 2018년 5월 23일
Hello all, I'm trying to create the S-function for the MAX6675. I've got it working on the Arduino IDE.
**************************************
I put the following in the different s-function tabs
tab Initalization
Number of discrete States -> 1 Sample mode -> Discrete Sample time -> 0.1
tab Data Properties
no INPUT Port only Output Port -> temp_celsius (double)
tab Libraries
#include <math.h>
#ifndef MATLAB_MEX_FILE
#define ARDUINO 100
#include <Arduino.h>
#include "max6675.h"
#include "max6675.cpp"
//Init the library
/*
thermoDO = 8;
thermoCS = 9;
thermoCLK = 10;
*/
MAX6675 thermocouple(10, 9, 8);
#endif
tab Continous Derivatives
no changes to example
tab Discrete Update
no changes to example
Building the s-function makes no trouble. After building for running on target (Arduino Leonardo) I'am receiving these failures: n file included from ../max6675.cpp:7:0, from ../s_func_MAX6675_wrapper.cpp:20: ../max6675.h:10:7: error: redefinition of 'class MAX6675' class MAX6675 { ^ In file included from ../s_func_MAX6675_wrapper.cpp:19:0: ../max6675.h:10:7: error: previous definition of 'class MAX6675' class MAX6675 { ^ gmake: * [s_func_MAX6675_wrapper.o] Error 1
What am I doing wrong???
In the zip file I included all the relevant files and models. In the txt file is the complete error message.
Thanks for the help...
with best regards
Florian

답변 (3개)

Indel Frost
Indel Frost 2017년 1월 19일
Hello did you get it to work. I am trying to do the same thing now for a project. I you did get it to work could you send me some help please. indelfrost@gmail.com

Tobias Wzl
Tobias Wzl 2018년 1월 11일
Hey I'm getting the Code compiled to the board but it doesnt show me any kind of temperature ...
Is there something I'm doing wrong, have you or somebody else solved your/this problem? If yes please contact me

Helen Vlachou
Helen Vlachou 2018년 4월 25일
Hello all, I just solved this problem. You have to go to .h file of your library and write in the beginning of the code: #ifndef MY_LIBRARY_H #define MY_LIBRARY_H and at the end of your code: #endif
  댓글 수: 1
Kurt Stewart
Kurt Stewart 2018년 5월 23일
that creates the bounds of the executable file

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by