SiMessagePort Won't Compile In Sketch

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
jet46
Posts: 20
Joined: Fri May 21, 2021 12:24 am

SiMessagePort Won't Compile In Sketch

#1 Post by jet46 »

Hello,

I am attempting to use the SiMessagePort library in an Arduino sketch however I cannot get it to compile. Here is the error I am receiving:

Code: Select all

C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c: In function 'si_message_port_init':
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:153:16: error: 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO_EVERY' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO_EVERY;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:153:16: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:156:16: error: 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_DUE' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_UNO'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_ARDUINO_DUE;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_ARDUINO_UNO
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:159:22: error: 'SIM_EXTERN_DEVICE_TYPE_ESP32' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_MAX'?
         lib.device = SIM_EXTERN_DEVICE_TYPE_ESP32;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      SIM_EXTERN_DEVICE_TYPE_MAX
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:162:22: error: 'SIM_EXTERN_DEVICE_TYPE_NODE_MCU' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP32'?
         lib.device = SIM_EXTERN_DEVICE_TYPE_NODE_MCU;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      SIM_EXTERN_DEVICE_TYPE_ESP32
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:165:16: error: 'SIM_EXTERN_DEVICE_TYPE_ESP8266' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP32'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_ESP8266;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_ESP32
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:168:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP8266'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_ESP8266
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:171:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_PP_2_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_PP_2_0;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:174:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_LC' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_LC;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:177:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:180:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:183:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_6' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_6;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:186:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0
C:\Users\jtest\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:189:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_1' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0'?
   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_4_1;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0
exit status 1
Error compiling for board Arduino Mega or Mega 2560.
Any idea how to fix this? Thanks!

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: SiMessagePort Won't Compile In Sketch

#2 Post by jph »

Looks like you haven't declared the Device in use properly. This also needs to be in the void setup() { }

from example -
messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_ARDUINO_MEGA_2560, SI_MESSAGE_PORT_CHANNEL_A, new_message_callback);

Please post your code for this here, and your relevant declarations for Messageport and type of arduino device you are using.
It is no real help just posting the compiler errors without an example of your code.
Joe. CISSP, MSc.

jet46
Posts: 20
Joined: Fri May 21, 2021 12:24 am

Re: SiMessagePort Won't Compile In Sketch

#3 Post by jet46 »

I tried this on the BasicExample.ino that was included with the download. I haven't changed anything in the example code. I am on Arduino 1.8.13 and have installed the message port libraries. In the IDE I have the board type set as the Arduino Mega 2560. Here is the code:

Code: Select all

/*
	Sim Innovations Message Port example:
	
	In this example we can communicate with Air Manager or Air Player over a standard USB cable.
	This is done using the Message Port library.
	
	See the code below on how to implement this library.
	
	More information on how to implement the Air Manager or Air Player side can be found here:
	https://siminnovations.com/wiki/index.php?title=Hw_message_port_add
	
	
	NOTE: 
	The Message Port library communicates with the PC using Serial Port 0 of the Arduino.
	Do not use Serial port 0 yourself!
*/

#include <si_message_port.hpp>

SiMessagePort* messagePort;

static void new_message_callback(uint16_t message_id, struct SiMessagePortPayload* payload) {
	// Do something with a message from Air Manager or Air Player

	// The arguments are only valid within this function!
	// Make a clone if you want to store it

	if (payload == NULL) {
		messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_INFO, (String)"Received without payload");
	}
	else {
		switch(payload->type) {
			case SI_MESSAGE_PORT_DATA_TYPE_BYTE:
				messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_INFO, (String)"Received " + payload->len + " bytes: " + payload->data_byte[0]);
				break;
			case SI_MESSAGE_PORT_DATA_TYPE_STRING:
				messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_INFO, (String)"Received string: " + payload->data_string);
				break;
			case SI_MESSAGE_PORT_DATA_TYPE_INTEGER:
				messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_INFO, (String)"Received " + payload->len + " integers" + payload->data_int[0]);
				break;
			case SI_MESSAGE_PORT_DATA_TYPE_FLOAT:
				messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_INFO, (String)"Received " + payload->len + " floats" + payload->data_float[0]);
				break;
		}
	}
}

void setup() {
	// Init library on channel A and Arduino type MEGA 2560
	messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_ARDUINO_MEGA_2560, SI_MESSAGE_PORT_CHANNEL_A, new_message_callback);
}

void loop() {
	// Make sure this function is called regularly
	messagePort->Tick();

	// You can send your own messages to Air Manager or Air Player
	//messagePort->SendMessage(123);
	//messagePort->SendMessage(123, "hello");
	//messagePort->SendMessage(123, (int32_t)1000);
	//messagePort->SendMessage(123, 2.5f);
	//messagePort->SendMessage(123, (uint8_t) 0xAA);
}
Thank you for taking a look.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#4 Post by marcel_felde »

Same problem here:

Imported Message Port Library into Arduino 1.8.13 and tried to export example code to Mega 2560: Error on compilation.

Deinstalled Arduino, installed 1.8.15: same problem.

Compiling other sketches on the Arduino works fine.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#5 Post by marcel_felde »

Flashing via Air Manager with the same Port works as usual.

Error does already appear during validating:

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: SiMessagePort Won't Compile In Sketch

#6 Post by jph »

Hi
I just tested the included example from the library and it compiles fine here
Using 1.8.15, but also no issue on earlier versions.
Can you check that the library is installed correctly ? - it should be under (your location) \Arduino\libraries\SiMessagePort
You will then have 2 folders examples and src and also the library.properties file

The version of the library I have is -

name=SI Message Port
version=3.7.0
author=Sim Innovations
maintainer=Sim Innovations <corjan@siminnovations.com>
sentence=Allows to couple Arduino projects to Air Manager or Air Player
paragraph=
category=Device Control
url=https://www.siminnovations.com
architectures=*


That is the latest Library and will be the same as you have. It sounds like a library install issue ?
messageport.jpg
Joe.
Last edited by jph on Sat May 22, 2021 7:35 am, edited 3 times in total.
Joe. CISSP, MSc.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#7 Post by marcel_felde »

It is under:

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#8 Post by marcel_felde »

Code: Select all

Arduino: 1.8.15 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c: In function 'si_message_port_init':

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:153:16: error: 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO_EVERY' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO_EVERY;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_ARDUINO_NANO

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:153:16: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:156:16: error: 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_DUE' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ARDUINO_UNO'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_ARDUINO_DUE;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_ARDUINO_UNO

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:159:22: error: 'SIM_EXTERN_DEVICE_TYPE_ESP32' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_MAX'?

         lib.device = SIM_EXTERN_DEVICE_TYPE_ESP32;

                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

                      SIM_EXTERN_DEVICE_TYPE_MAX

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:162:22: error: 'SIM_EXTERN_DEVICE_TYPE_NODE_MCU' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP32'?

         lib.device = SIM_EXTERN_DEVICE_TYPE_NODE_MCU;

                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                      SIM_EXTERN_DEVICE_TYPE_ESP32

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:165:16: error: 'SIM_EXTERN_DEVICE_TYPE_ESP8266' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP32'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_ESP8266;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_ESP32

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:168:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_ESP8266'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_ESP8266

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:171:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_PP_2_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_PP_2_0;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:174:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_LC' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_LC;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:177:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:180:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_3_2

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:183:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_6' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_3_6;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_3_5

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:186:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_2_0

C:\Users\Myname\Documents\Arduino\libraries\SiMessagePort\src\si_message_port.c:189:16: error: 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_1' undeclared (first use in this function); did you mean 'SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0'?

   lib.device = SIM_EXTERN_DEVICE_TYPE_TEENSY_4_1;

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                SIM_EXTERN_DEVICE_TYPE_TEENSY_4_0

exit status 1

Fehler beim Kompilieren für das Board Arduino Mega or Mega 2560.



Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#9 Post by marcel_felde »

@jph May it be that you are using an older library that differs from the actual version? I will try to reinstall it once again now.

@Ralph In the video tutorial, there is still an old wiki page visible and it is also explained that you have to manually copy some files. Is this obsolete meanwhile?

@jet46 Where are you from? There was a problem with gmax compiling files as long as the system is not set to "english". I am from germany so this could be the case here. Just a guess from my side...

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: SiMessagePort Won't Compile In Sketch

#10 Post by marcel_felde »

Reinstalling the library did not help.

I can compile an empty file without problems. As soon as I include "#include <si_message_port.hpp>", the error message appears.

Greetings,

Marcel

Post Reply