Skip to content
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

Include header guards in MQTT.h #51

Closed
alignan opened this issue Mar 4, 2017 · 5 comments
Closed

Include header guards in MQTT.h #51

alignan opened this issue Mar 4, 2017 · 5 comments

Comments

@alignan
Copy link

alignan commented Mar 4, 2017

To avoid errors like error: previous definition of 'class MQTT'

@alignan alignan changed the title Missing header guards in MQTT.h Include header guards in MQTT.h Mar 4, 2017
@hirotakaster
Copy link
Owner

I don't know what's happen on only this error line.

@ScruffR
Copy link

ScruffR commented Apr 11, 2017

@hirotakaster, the common practice for all headers should be to guard against multiple inclusion.
This is either done as

#ifndef _YOUR_LIBRARY_H_
#define _YOUR_LIBRARY_H_
// here follows the code
#endif

or via

#pragma once
// here follows your code

hirotakaster added a commit that referenced this issue Apr 12, 2017
@hirotakaster
Copy link
Owner

Hi @ScruffR
I add ifdef to header file, but I can't use MQTT my lib on WebIDE and local Particle Dev!! compile message is "MQTT.h: No such file or directory".

#include <MQTT.h>
#include "MQTT.h"
#include "MQTT/MQTT.h"

all patter is fail "MQTT.h: No such file or directory" now.
I don't know why this happen, but I think Particle community lib is broken now.

@ScruffR
Copy link

ScruffR commented Apr 12, 2017

That is due to an issue on the Particle side.
particle-iot-archived/particle-dev-libraries#26

You need to remove the nested MQTT folder with the header stubs (on your local copy of the lib, not on the published version).

@hirotakaster
Copy link
Owner

@ScruffR
Okay, thank you. I can compile on "Particle Dev" local pc.
But still can't compile on WebIDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants