Error S function builder class redefenition

2 visualizzazioni (ultimi 30 giorni)
Florian Soldner
Florian Soldner il 31 Lug 2016
Commentato: Kurt Stewart il 23 Mag 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

Risposte (3)

Indel Frost
Indel Frost il 19 Gen 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

Tobias Wzl
Tobias Wzl il 11 Gen 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

Helen Vlachou
Helen Vlachou il 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

Community Treasure Hunt

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

Start Hunting!

Translated by