Error: two or more data types in declaration of 'Signature' - Just started to happen ?

I've some code that I'm updating, but has compiled fine for ages....yet today it is suddenly giving this error;

Vibe_3.0:47:3: error: two or more data types in declaration of 'Signature'
} Signature;
^~~~~~~~~
Vibe_3.0:48:1: error: 'Signature' does not name a type; did you mean 'sigpause'?
Signature signature; // Create a "Signature" variable and call it "signature"

The code is as follows and hasn't hanged for weeks;

struct {
   char pixels[64][96];                    // px=0-96; py=0-63 when drawing
} Signature;
Signature signature;                      // Create a "Signature" variable and call it "signature"

I've tried changing the name from Signature to Sigarray, in case the upper and lower case 's' is confusing things.

Not done any update of the IDE - which is 1.8.13

All very strange - any ideas?

Try this

struct Signature
{
    char pixels[64][96];  // px=0-96; py=0-63 when drawing
};
Signature signature;  // Declare a variable of type Signature

Why bother to use a struct when it only has one variable in it ?

Thanks tried that (cut & pasted) - but same error !

Vibe_3.0test1:48:1: error: multiple types in one declaration
};
^
Vibe_3.0test1:48:1: error: declaration does not declare anything [-fpermissive]

You're right - doesn't need to be a Struct - there used to be other elements in there but no longer needed. I could change the code and just define an array I guess.

Please post a complete sketch that illustrates the problem

I'm just parring it back to the basics to see if there's something else causing the problem. Will post when I get it to the basics

OK I've cut it back to very basics - and it compiles ok - so I guess it must be something in the rest of the code.

I'll start putting functions back in until it fails - and report back.

thanks for your time and help

Phil

/*
    Video: https://www.youtube.com/watch?v=oCMOYS71NIU
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esBunker52!p32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
    Ported to Arduino ESP32 by Evandro Copercini

   Create a BLE server that, once we receive a connection, will send periodic notifications.
   The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
   Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE" 
   Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with  "NOTIFY"

   The design of creating the BLE server is:
   1. Create a BLE Server
   2. Create a BLE Service
   3. Create a BLE Characteristic on the Service
   4. Create a BLE Descriptor on the characteristic
   5. Start the service.
   6. Start advertising.

   In this example rxValue is the data received (only accessible inside that function).
   And txValue is the data to be sent, in this example just a byte incremented every second. 
*/
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <TFT_eSPI.h>        // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();   // Invoke library


// Define the space to create a structure that is big enough to contain the 2D array of pixels for signature.
//  Plus Other signature variables 
struct Signature
{
    char pixels[64][96];  // px=0-96; py=0-63 when drawing
};
Signature signature;  // Declare a variable of type Signature


void setup() {
  Serial.begin(115200);
  Serial.println("Done setup"); 
}
// End of Setup


// Main Loop
void loop() {
   delay(2000); 
}                       
//
//




Sorted it - I had a line containing just 'char ' earlier on in the definitions, something I'd started to define last time and obviously didn't complete and forgot it was there.

Very confusing error though - why not just error that ??

Thanks for help.

'char' on its own on a line is not an error. Bear in mind that the compiler ignores white space such as Carriage Returns and Linefeeds so as far as it is concerned the 'char' will have been followed by what is on the next line.

Something like this is perfectly valid

char
  x 

    = 

                    'A'

                        ;

The code will be parsed until an error is found and that line will be reported as the error even it is actually caused by something wrong earlier in the code

Ok, Understand. Thanks for that and your patience helping.

Phil

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.