Skip to content

Name collision with ArduinoIoTCloud library #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Marcelol52 opened this issue Dec 11, 2024 · 0 comments
Open

Name collision with ArduinoIoTCloud library #52

Marcelol52 opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@Marcelol52
Copy link

Marcelol52 commented Dec 11, 2024

Describe the problem

When the ArduinoIoTCloud library is used in the same sketch as this library, compilation fails due to a name collision:

In file included from c:\Users\per\Documents\Arduino\libraries\Arduino_UnifiedStorage\src/Arduino_UnifiedStorage.h:10:0,
                 from C:\Users\per\Documents\Arduino\000-support\github\arduino-libraries\Arduino_UnifiedStorage\52\52.ino:2:
c:\Users\per\Documents\Arduino\libraries\Arduino_UnifiedStorage\src/Types.h:6:17: error: redeclaration of 'READ'
 enum FileMode { READ, WRITE, APPEND };
                 ^~~~
In file included from C:\Users\per\Documents\Arduino\000-support\github\arduino-libraries\Arduino_UnifiedStorage\52\52.ino:1:0:
c:\Users\per\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:53:3: note: previous declaration 'permissionType READ'
   READ      = 0x01,
   ^~~~
In file included from c:\Users\per\Documents\Arduino\libraries\Arduino_UnifiedStorage\src/Arduino_UnifiedStorage.h:10:0,
                 from C:\Users\per\Documents\Arduino\000-support\github\arduino-libraries\Arduino_UnifiedStorage\52\52.ino:2:
c:\Users\per\Documents\Arduino\libraries\Arduino_UnifiedStorage\src/Types.h:6:23: error: redeclaration of 'WRITE'
 enum FileMode { READ, WRITE, APPEND };
                       ^~~~~
In file included from C:\Users\per\Documents\Arduino\000-support\github\arduino-libraries\Arduino_UnifiedStorage\52\52.ino:1:0:
c:\Users\per\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:54:3: note: previous declaration 'permissionType WRITE'
   WRITE     = 0x02,
   ^~~~~

To reproduce

Compile the following minimal demonstration sketch:

#include <ArduinoIoTCloud.h>
#include <Arduino_UnifiedStorage.h>
void setup() {}
void loop() {}

Expected behavior

Library does not pollute the namespace with declarations of common names. When it is necessary to expose a declaration, a distinctive name (e.g., Arduino_UnifiedStorageFileMode::READ) is used.

Arduino_UnifiedStorage version

d41bdd0

Additional context

Additional reports

@per1234 per1234 changed the title Conflict between Arduino_UnifiedStorage and ArduinoIoTCloud Name collision with ArduinoIoTCloud library Dec 11, 2024
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants