[SOLVED] C++/cpp, grove_dht_pro & grove_rgb_lcd not compiling

Hi there again,

i have the Rasp. Pi3 mod. B with Kit GrovePi+ and im writing with c++.

Seems there is a problem when i try to use the grove_dht_pro & grove_rgb_lcd in
a single programm. The header files override each other so i can only use one
device in a programm.

Do i have a code problem?!?
code goes here ->

#include "grovepi.h"
#include "grove_rgb_lcd.h"
#include "grove_dht_pro.h"

compiler says: “error: ‘DHT’ was not declared in this scope”

… when i rewrite the code 2 thiz:

#include "grovepi.h"
#include "grove_dht_pro.h"
#include "grove_rgb_lcd.h"

then compiler says: “error: ‘LCD’ was not declared in this scope”

thx in advance

Hi @chkr,

So I’ve compiled the following code and I didn’t have a problem with the latest GrovePi repo.

#include "grovepi.h"
#include "grove_rgb_lcd.h"
#include "grove_dht_pro.h"

int main()
{
    return 0;
}

Apart from this small example, I’ve also compiled the rest of example programs in the Software/Cpp folder of the GrovePi repo and I haven’t had any problems.

This tells me you:

  1. Haven’t installed the package and you’re compiling as if you have the package installed.

  2. Or that you have installed the package but you’re not compiling the code right.

In either case, you have to follow the instructions provided in our repo as they explain how a program has to be compiled.
So, please read the README provided on the following GitHub page:

If there are any other questions regarding this topic, please feel free to tell us.

Thank you!

hi lucian, thx for your reply(s),
i copied the code of the header files into a single header file and removed the
"#ifndef" and “#endif” in both. … perhaps namespaces proplem or so, but i think
its SOLVED!

Hi @chkr,

That’s great to hear. I would though advice you to follow the instruction we have provided.
But then again, whatever works for you is also great.

Thank you!

This topic was automatically closed after 19 hours. New replies are no longer allowed.