Two libraries collide. Ambiguous functions/variables?Arduino standard libraries locationMaking my own librariesPass a member function pointer to a method of a foreign class (EDB Lib)Integrating two Arduino Ethernet libraries in one sketchUsing Arduino libraries with ARM based microcontrollerLibraries/classes using other libraries/classesArduino Libraries: Declaring variables as public?Error: “undefined reference to …” when calling non-void class' functions from within classLibraries not included correctlyArduino core libraries
Was the Ford Model T black because of the speed black paint dries?
How were Martello towers supposed to work?
Is there a word for a message that is intended to be intercepted by an adversary?
Why was hardware diversification an asset for the IBM PC ecosystem?
Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?
Keep milk (or milk alternative) for a day without a fridge
Is an acid a salt? Why (not)?
What is this welding tool I found in my attic?
references on the empirical study on the practice of OR
Managing and organizing the massively increased number of classes after switching to SOLID?
Was lunar module "pilot" Harrison Schmitt legally a "pilot" at the time?
Why does my String turn into Integers instead of letters after I add characters with +?
Does throwing a penny at a train stop the train?
What is the best way to stacked subscripts for a matrix?
Storming Area 51
Why do people keep referring to Leia as Princess Leia, even after the destruction of Alderaan?
Is there any word for "disobedience to God"?
Professor falsely accusing me of cheating in a class he does not teach, two months after end of the class. What precautions should I take?
Is anyone advocating the promotion of homosexuality in UK schools?
How to find the shape parameters of of a beta distribution given the position of two quantiles?
Do you know your 'KVZ's?
Are unclear "take-it or leave-it" contracts interpreted in my favor?
How can I deal with a player trying to insert real-world mythology into my homebrew setting?
What's the maximum time an interrupt service routine can take to execute on atmega328p?
Two libraries collide. Ambiguous functions/variables?
Arduino standard libraries locationMaking my own librariesPass a member function pointer to a method of a foreign class (EDB Lib)Integrating two Arduino Ethernet libraries in one sketchUsing Arduino libraries with ARM based microcontrollerLibraries/classes using other libraries/classesArduino Libraries: Declaring variables as public?Error: “undefined reference to …” when calling non-void class' functions from within classLibraries not included correctlyArduino core libraries
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I get several errors once I try to include these two libraries:
error: expected unqualified-id before '{' token
#define DEBUG_PRINTLN(...)
#include <DHT.h>
#include <DGS.h>
void setup()
void loop()
Apparently DEBUG_PRINTLN is causing the problems, because it is defined as a private function in DGS.h and as a constant (#define) in DHT.h.
Including DGS.h before DHT.h does not throw errors. But is this a safe workaround or might I run into errors later? How can I deal with that, without modifying the libraries?
DGS.h:
/*
DGS_25SEP17.h - Library for reading KWJ Engineering with SPEC Sensors on Digital SDK with firmware date 25SEP17.
Created by David E. Peaslee, Mar 29, 2018.
*/
#ifndef _DGS_h
#define _DGS_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(SPARK)
//#include "application.h"
#else
#include "WProgram.h"
#endif
#include "Stream.h"
class DGS
private:
Stream *_mySerial;
long dataArray[11]; //Multipurpose array
//void unlock(void);
void DEBUG_PRINTLN(long x);
void DEBUG_PRINTLN(float x);
void DEBUG_PRINTLN(String x);
void DEBUG_PRINT(long x);
void DEBUG_PRINT(float x);
void DEBUG_PRINT(String x);
public:
DGS(Stream &mySerial); //Class that represents DULP with Stream as class for Serial
DGS(Stream *mySerial); //Class that represents DULP with Stream as class for Serial
bool DEBUG;
int setToff(float offset); //Sets a temperature offset
int setBC(String BC); //Initializes DGS with all information from barcode, only way to set Span
String getFW(void); //Returns the Firmware Date
int getLMP(void); //Loads LMP[3] with register values from LMP91000
int LMP[3]; //LMP Registers, needs to be loaded with getLMP
int setLMP(int R1, int R2, int R3); //Sets new LMP registers and reintializes LMP
int zero(void); //Zeros to current reading, Zero only in a clean air environment
int setXSpan(float); //ReCalibrates device, only should be used after zero, and using a calibrated gas
int getData(char c); //Gets the data and loads into variables
long getConc(char x = 'p'); //Reads concentration from current data array 'p' ppb or 'c' counts
long getTemp(char t = 'C'); //Reads temperature from current data array 'C' for Celsius or 'F' for Fahrenheit
long getRh(char r = 'r'); //Reads Rh from current data array 'r' for Rh and 'c' for counts
void getEEPROM(void); //Loads variables into EEPROM E[5] and e[14] arrays, outputs EEPROM if DEBUG is true
String eepromStr[5]; //Stores the character based EEPROM data
long eepromInt[13]; //Stores the integer based EEPROM data
float Sensitivity_Code; //Stores the sensitivity coefficient in nA/PPM
;
#endif
DHT.h:
/* DHT library
MIT license
written by Adafruit Industries
*/
#ifndef DHT_H
#define DHT_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Uncomment to enable printing out nice debug messages.
//#define DHT_DEBUG
// Define where debug output will be printed.
#define DEBUG_PRINTER Serial
// Setup debug printing macros.
#ifdef DHT_DEBUG
#define DEBUG_PRINT(...) DEBUG_PRINTER.print(__VA_ARGS__);
#define DEBUG_PRINTLN(...) DEBUG_PRINTER.println(__VA_ARGS__);
#else
#define DEBUG_PRINT(...)
#define DEBUG_PRINTLN(...)
#endif
// Define types of sensors.
#define DHT11 11
#define DHT12 12
#define DHT22 22
#define DHT21 21
#define AM2301 21
class DHT
public:
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
void begin(uint8_t usec=55);
float readTemperature(bool S=false, bool force=false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(bool isFahrenheit=true);
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
float readHumidity(bool force=false);
bool read(bool force=false);
private:
uint8_t data[5];
uint8_t _pin, _type;
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and bitmask
// for the digital pin connected to the DHT. Other platforms will use digitalRead.
uint8_t _bit, _port;
#endif
uint32_t _lastreadtime, _maxcycles;
bool _lastresult;
uint8_t pullTime; // Time (in usec) to pull up data line before reading
uint32_t expectPulse(bool level);
;
class InterruptLock
public:
InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
noInterrupts();
#endif
~InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
interrupts();
#endif
;
#endif
library compilation-errors
add a comment |
I get several errors once I try to include these two libraries:
error: expected unqualified-id before '{' token
#define DEBUG_PRINTLN(...)
#include <DHT.h>
#include <DGS.h>
void setup()
void loop()
Apparently DEBUG_PRINTLN is causing the problems, because it is defined as a private function in DGS.h and as a constant (#define) in DHT.h.
Including DGS.h before DHT.h does not throw errors. But is this a safe workaround or might I run into errors later? How can I deal with that, without modifying the libraries?
DGS.h:
/*
DGS_25SEP17.h - Library for reading KWJ Engineering with SPEC Sensors on Digital SDK with firmware date 25SEP17.
Created by David E. Peaslee, Mar 29, 2018.
*/
#ifndef _DGS_h
#define _DGS_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(SPARK)
//#include "application.h"
#else
#include "WProgram.h"
#endif
#include "Stream.h"
class DGS
private:
Stream *_mySerial;
long dataArray[11]; //Multipurpose array
//void unlock(void);
void DEBUG_PRINTLN(long x);
void DEBUG_PRINTLN(float x);
void DEBUG_PRINTLN(String x);
void DEBUG_PRINT(long x);
void DEBUG_PRINT(float x);
void DEBUG_PRINT(String x);
public:
DGS(Stream &mySerial); //Class that represents DULP with Stream as class for Serial
DGS(Stream *mySerial); //Class that represents DULP with Stream as class for Serial
bool DEBUG;
int setToff(float offset); //Sets a temperature offset
int setBC(String BC); //Initializes DGS with all information from barcode, only way to set Span
String getFW(void); //Returns the Firmware Date
int getLMP(void); //Loads LMP[3] with register values from LMP91000
int LMP[3]; //LMP Registers, needs to be loaded with getLMP
int setLMP(int R1, int R2, int R3); //Sets new LMP registers and reintializes LMP
int zero(void); //Zeros to current reading, Zero only in a clean air environment
int setXSpan(float); //ReCalibrates device, only should be used after zero, and using a calibrated gas
int getData(char c); //Gets the data and loads into variables
long getConc(char x = 'p'); //Reads concentration from current data array 'p' ppb or 'c' counts
long getTemp(char t = 'C'); //Reads temperature from current data array 'C' for Celsius or 'F' for Fahrenheit
long getRh(char r = 'r'); //Reads Rh from current data array 'r' for Rh and 'c' for counts
void getEEPROM(void); //Loads variables into EEPROM E[5] and e[14] arrays, outputs EEPROM if DEBUG is true
String eepromStr[5]; //Stores the character based EEPROM data
long eepromInt[13]; //Stores the integer based EEPROM data
float Sensitivity_Code; //Stores the sensitivity coefficient in nA/PPM
;
#endif
DHT.h:
/* DHT library
MIT license
written by Adafruit Industries
*/
#ifndef DHT_H
#define DHT_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Uncomment to enable printing out nice debug messages.
//#define DHT_DEBUG
// Define where debug output will be printed.
#define DEBUG_PRINTER Serial
// Setup debug printing macros.
#ifdef DHT_DEBUG
#define DEBUG_PRINT(...) DEBUG_PRINTER.print(__VA_ARGS__);
#define DEBUG_PRINTLN(...) DEBUG_PRINTER.println(__VA_ARGS__);
#else
#define DEBUG_PRINT(...)
#define DEBUG_PRINTLN(...)
#endif
// Define types of sensors.
#define DHT11 11
#define DHT12 12
#define DHT22 22
#define DHT21 21
#define AM2301 21
class DHT
public:
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
void begin(uint8_t usec=55);
float readTemperature(bool S=false, bool force=false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(bool isFahrenheit=true);
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
float readHumidity(bool force=false);
bool read(bool force=false);
private:
uint8_t data[5];
uint8_t _pin, _type;
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and bitmask
// for the digital pin connected to the DHT. Other platforms will use digitalRead.
uint8_t _bit, _port;
#endif
uint32_t _lastreadtime, _maxcycles;
bool _lastresult;
uint8_t pullTime; // Time (in usec) to pull up data line before reading
uint32_t expectPulse(bool level);
;
class InterruptLock
public:
InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
noInterrupts();
#endif
~InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
interrupts();
#endif
;
#endif
library compilation-errors
add a comment |
I get several errors once I try to include these two libraries:
error: expected unqualified-id before '{' token
#define DEBUG_PRINTLN(...)
#include <DHT.h>
#include <DGS.h>
void setup()
void loop()
Apparently DEBUG_PRINTLN is causing the problems, because it is defined as a private function in DGS.h and as a constant (#define) in DHT.h.
Including DGS.h before DHT.h does not throw errors. But is this a safe workaround or might I run into errors later? How can I deal with that, without modifying the libraries?
DGS.h:
/*
DGS_25SEP17.h - Library for reading KWJ Engineering with SPEC Sensors on Digital SDK with firmware date 25SEP17.
Created by David E. Peaslee, Mar 29, 2018.
*/
#ifndef _DGS_h
#define _DGS_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(SPARK)
//#include "application.h"
#else
#include "WProgram.h"
#endif
#include "Stream.h"
class DGS
private:
Stream *_mySerial;
long dataArray[11]; //Multipurpose array
//void unlock(void);
void DEBUG_PRINTLN(long x);
void DEBUG_PRINTLN(float x);
void DEBUG_PRINTLN(String x);
void DEBUG_PRINT(long x);
void DEBUG_PRINT(float x);
void DEBUG_PRINT(String x);
public:
DGS(Stream &mySerial); //Class that represents DULP with Stream as class for Serial
DGS(Stream *mySerial); //Class that represents DULP with Stream as class for Serial
bool DEBUG;
int setToff(float offset); //Sets a temperature offset
int setBC(String BC); //Initializes DGS with all information from barcode, only way to set Span
String getFW(void); //Returns the Firmware Date
int getLMP(void); //Loads LMP[3] with register values from LMP91000
int LMP[3]; //LMP Registers, needs to be loaded with getLMP
int setLMP(int R1, int R2, int R3); //Sets new LMP registers and reintializes LMP
int zero(void); //Zeros to current reading, Zero only in a clean air environment
int setXSpan(float); //ReCalibrates device, only should be used after zero, and using a calibrated gas
int getData(char c); //Gets the data and loads into variables
long getConc(char x = 'p'); //Reads concentration from current data array 'p' ppb or 'c' counts
long getTemp(char t = 'C'); //Reads temperature from current data array 'C' for Celsius or 'F' for Fahrenheit
long getRh(char r = 'r'); //Reads Rh from current data array 'r' for Rh and 'c' for counts
void getEEPROM(void); //Loads variables into EEPROM E[5] and e[14] arrays, outputs EEPROM if DEBUG is true
String eepromStr[5]; //Stores the character based EEPROM data
long eepromInt[13]; //Stores the integer based EEPROM data
float Sensitivity_Code; //Stores the sensitivity coefficient in nA/PPM
;
#endif
DHT.h:
/* DHT library
MIT license
written by Adafruit Industries
*/
#ifndef DHT_H
#define DHT_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Uncomment to enable printing out nice debug messages.
//#define DHT_DEBUG
// Define where debug output will be printed.
#define DEBUG_PRINTER Serial
// Setup debug printing macros.
#ifdef DHT_DEBUG
#define DEBUG_PRINT(...) DEBUG_PRINTER.print(__VA_ARGS__);
#define DEBUG_PRINTLN(...) DEBUG_PRINTER.println(__VA_ARGS__);
#else
#define DEBUG_PRINT(...)
#define DEBUG_PRINTLN(...)
#endif
// Define types of sensors.
#define DHT11 11
#define DHT12 12
#define DHT22 22
#define DHT21 21
#define AM2301 21
class DHT
public:
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
void begin(uint8_t usec=55);
float readTemperature(bool S=false, bool force=false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(bool isFahrenheit=true);
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
float readHumidity(bool force=false);
bool read(bool force=false);
private:
uint8_t data[5];
uint8_t _pin, _type;
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and bitmask
// for the digital pin connected to the DHT. Other platforms will use digitalRead.
uint8_t _bit, _port;
#endif
uint32_t _lastreadtime, _maxcycles;
bool _lastresult;
uint8_t pullTime; // Time (in usec) to pull up data line before reading
uint32_t expectPulse(bool level);
;
class InterruptLock
public:
InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
noInterrupts();
#endif
~InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
interrupts();
#endif
;
#endif
library compilation-errors
I get several errors once I try to include these two libraries:
error: expected unqualified-id before '{' token
#define DEBUG_PRINTLN(...)
#include <DHT.h>
#include <DGS.h>
void setup()
void loop()
Apparently DEBUG_PRINTLN is causing the problems, because it is defined as a private function in DGS.h and as a constant (#define) in DHT.h.
Including DGS.h before DHT.h does not throw errors. But is this a safe workaround or might I run into errors later? How can I deal with that, without modifying the libraries?
DGS.h:
/*
DGS_25SEP17.h - Library for reading KWJ Engineering with SPEC Sensors on Digital SDK with firmware date 25SEP17.
Created by David E. Peaslee, Mar 29, 2018.
*/
#ifndef _DGS_h
#define _DGS_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(SPARK)
//#include "application.h"
#else
#include "WProgram.h"
#endif
#include "Stream.h"
class DGS
private:
Stream *_mySerial;
long dataArray[11]; //Multipurpose array
//void unlock(void);
void DEBUG_PRINTLN(long x);
void DEBUG_PRINTLN(float x);
void DEBUG_PRINTLN(String x);
void DEBUG_PRINT(long x);
void DEBUG_PRINT(float x);
void DEBUG_PRINT(String x);
public:
DGS(Stream &mySerial); //Class that represents DULP with Stream as class for Serial
DGS(Stream *mySerial); //Class that represents DULP with Stream as class for Serial
bool DEBUG;
int setToff(float offset); //Sets a temperature offset
int setBC(String BC); //Initializes DGS with all information from barcode, only way to set Span
String getFW(void); //Returns the Firmware Date
int getLMP(void); //Loads LMP[3] with register values from LMP91000
int LMP[3]; //LMP Registers, needs to be loaded with getLMP
int setLMP(int R1, int R2, int R3); //Sets new LMP registers and reintializes LMP
int zero(void); //Zeros to current reading, Zero only in a clean air environment
int setXSpan(float); //ReCalibrates device, only should be used after zero, and using a calibrated gas
int getData(char c); //Gets the data and loads into variables
long getConc(char x = 'p'); //Reads concentration from current data array 'p' ppb or 'c' counts
long getTemp(char t = 'C'); //Reads temperature from current data array 'C' for Celsius or 'F' for Fahrenheit
long getRh(char r = 'r'); //Reads Rh from current data array 'r' for Rh and 'c' for counts
void getEEPROM(void); //Loads variables into EEPROM E[5] and e[14] arrays, outputs EEPROM if DEBUG is true
String eepromStr[5]; //Stores the character based EEPROM data
long eepromInt[13]; //Stores the integer based EEPROM data
float Sensitivity_Code; //Stores the sensitivity coefficient in nA/PPM
;
#endif
DHT.h:
/* DHT library
MIT license
written by Adafruit Industries
*/
#ifndef DHT_H
#define DHT_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Uncomment to enable printing out nice debug messages.
//#define DHT_DEBUG
// Define where debug output will be printed.
#define DEBUG_PRINTER Serial
// Setup debug printing macros.
#ifdef DHT_DEBUG
#define DEBUG_PRINT(...) DEBUG_PRINTER.print(__VA_ARGS__);
#define DEBUG_PRINTLN(...) DEBUG_PRINTER.println(__VA_ARGS__);
#else
#define DEBUG_PRINT(...)
#define DEBUG_PRINTLN(...)
#endif
// Define types of sensors.
#define DHT11 11
#define DHT12 12
#define DHT22 22
#define DHT21 21
#define AM2301 21
class DHT
public:
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
void begin(uint8_t usec=55);
float readTemperature(bool S=false, bool force=false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(bool isFahrenheit=true);
float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
float readHumidity(bool force=false);
bool read(bool force=false);
private:
uint8_t data[5];
uint8_t _pin, _type;
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and bitmask
// for the digital pin connected to the DHT. Other platforms will use digitalRead.
uint8_t _bit, _port;
#endif
uint32_t _lastreadtime, _maxcycles;
bool _lastresult;
uint8_t pullTime; // Time (in usec) to pull up data line before reading
uint32_t expectPulse(bool level);
;
class InterruptLock
public:
InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
noInterrupts();
#endif
~InterruptLock()
#if !defined(ARDUINO_ARCH_NRF52)
interrupts();
#endif
;
#endif
library compilation-errors
library compilation-errors
asked Jul 3 at 11:57
wheelerwheeler
1153 bronze badges
1153 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h
If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ function names with the content of the macros from DHT.h and the result doesn't make sense for the compiler.
You could do #undef DEBUG_PRINT and #undef DEBUG_PRINTLN after DHT.h to undefine the macros for the rest of the sketch. DHT.cpp includes DHT.h and will have the macros defined.
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "540"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f66814%2ftwo-libraries-collide-ambiguous-functions-variables%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h
If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ function names with the content of the macros from DHT.h and the result doesn't make sense for the compiler.
You could do #undef DEBUG_PRINT and #undef DEBUG_PRINTLN after DHT.h to undefine the macros for the rest of the sketch. DHT.cpp includes DHT.h and will have the macros defined.
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
add a comment |
The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h
If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ function names with the content of the macros from DHT.h and the result doesn't make sense for the compiler.
You could do #undef DEBUG_PRINT and #undef DEBUG_PRINTLN after DHT.h to undefine the macros for the rest of the sketch. DHT.cpp includes DHT.h and will have the macros defined.
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
add a comment |
The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h
If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ function names with the content of the macros from DHT.h and the result doesn't make sense for the compiler.
You could do #undef DEBUG_PRINT and #undef DEBUG_PRINTLN after DHT.h to undefine the macros for the rest of the sketch. DHT.cpp includes DHT.h and will have the macros defined.
The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h
If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ function names with the content of the macros from DHT.h and the result doesn't make sense for the compiler.
You could do #undef DEBUG_PRINT and #undef DEBUG_PRINTLN after DHT.h to undefine the macros for the rest of the sketch. DHT.cpp includes DHT.h and will have the macros defined.
edited Jul 4 at 6:39
answered Jul 3 at 12:18
JurajJuraj
9,9422 gold badges12 silver badges29 bronze badges
9,9422 gold badges12 silver badges29 bronze badges
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
add a comment |
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
Thanks! I assume by 'GBS' you mean 'DGS'?
– wheeler
Jul 4 at 6:23
add a comment |
Thanks for contributing an answer to Arduino Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f66814%2ftwo-libraries-collide-ambiguous-functions-variables%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown