When I run just the example sketch of just the Adafruit_SGP30.h or Adafruit_SGP40.h seperately there are no issues. When I combine both libraries together I get an error here:
Adafruit_SGP30 sgp;
Adafruit_SGP40 sgp; //ERROR
The error is:
note: previous declaration as 'Adafruit_SGP30 sgp'
Adafruit_SGP30 sgp;
^~~
exit status 1
Compilation error: conflicting declaration 'Adafruit_SGP40 sgp'
Adafruit_SGP30.h and Adafruit_SGP40.h library issue
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- 0miker0
- Posts: 60
- Joined: Mon Sep 12, 2011 8:13 am
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Adafruit_SGP30.h and Adafruit_SGP40.h library issue
You're trying to create two things with the same name. The first succeeds. The second fails (since name is already used).
Just give them different names:
Just give them different names:
Code: Select all
Adafruit_SGP30 sgp30;
Adafruit_SGP40 sgp40;
Please be positive and constructive with your questions and comments.