MATLAB Answers

Error S function builder class redefenition

8 views (last 30 days)
Florian Soldner
Florian Soldner on 31 Jul 2016
Commented: Kurt Stewart on 23 May 2018
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

  0 Comments

Sign in to comment.

Answers (3)

Indel Frost
Indel Frost on 19 Jan 2017
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

  0 Comments

Sign in to comment.


Tobias Wzl
Tobias Wzl on 11 Jan 2018
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

  0 Comments

Sign in to comment.


Helen Vlachou
Helen Vlachou on 25 Apr 2018
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 Comment

Kurt Stewart
Kurt Stewart on 23 May 2018
that creates the bounds of the executable file

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by