Pages: [1]   Go Down
Author Topic: 'LOW' was not declared in this scope  (Read 1140 times)
0 Members and 1 Guest are viewing this topic.
Loughborough, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Bloody semicolon
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am splitting my code up into tab (so seperate .cpp and .h files) to keep things organised, then using #includes to bring it all together.

I'm aware of the need to "#include <WProgram.h>" because I'm using "analogRead()", however I am getting the following compiler error on a different object.  I'm assuming it's a similar problem that I need to include a random header because it's not in a .pde file, and LOW is a standard declaration.

Does anyone know the solution?

Quote
In file included from pointers.cpp:4:
/REALTIME.h: In constructor 'CTime::CTime()':
REALTIME.h:7: error: 'LOW' was not declared in this scope

pointers.pde is the main file
realtime.h and .cpp are an included object that has the following line in it:
Code:
ledState=LOW;

To all those helping, many thanks.  I have Googled this but found nothing, nor anything in the forums.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm assuming it's a similar problem that I need to include a random header because it's not in a .pde file, and LOW is a standard declaration.
I suppose you could just try adding a random header file. When you choose the right random header file (wiring.h), the results would be better.
Logged

Loughborough, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Bloody semicolon
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good idea, just tried every header file in /hardware/ardiono/cores/ardiuino/ which is where WProgram.h is.  No luck.

EDIT:
Found the problem, the variable I was setting to LOW was a global variable.  For some reason it didnt like this, so I have made it a local variable & now it compiles.

So, dodgy error message; LOW is valid, what you're assigning it to is not (in my case anyway!0

cheers
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Found the problem, the variable I was setting to LOW was a global variable.  For some reason it didnt like this, so I have made it a local variable & now it compiles.

???

Never heard of this before, that you can't assign LOW to global variables.
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 64
Posts: 2101
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Found the problem, the variable I was setting to LOW was a global variable.  For some reason it didnt like this, so I have made it a local variable & now it compiles.
???


Too true, scope of objects plays no part in this. Adding the header include after the variable declaration will produce this.
Logged


Pages: [1]   Go Up
Jump to: