struct compilation issue

I am receiving this compilation error: Command.h:5: error: expected specifier-qualifier-list before 'boolean'
Any ideas?

#ifndef COMMAND_H
#define COMMAND_H

typedef struct Command
{
boolean Active;
char Color;
int Status;
int Duration;
} Command;

#endif

What compilation error?

Like Arrch said, it would help if you posted the error. It probably has to do with how the IDE changes your code. If I compile your posted code, the IDE (version 1.0.1) changes it to the following.

#ifndef COMMAND_H
#define COMMAND_H

#include "Arduino.h"
typedef struct Command
{
  boolean Active;
  char Color;
  int Status;
  int Duration;
} Command;

#endif

I'm sorry, here it is: Command.h:5: error: expected specifier-qualifier-list before 'boolean'

The file's name is "URL_Parser.c" if that matters.

I suspect that the compiler doesn't like you using Command for the tag and the new type.

Include Arduino.h at the top of the URL_Parser.c file.

mkwired:
Include Arduino.h at the top of the URL_Parser.c file.

This should be the problem; the boolean type is defined in Arduino.h

In libraries (.cpp/.c and .h files), the Arduino library is not automatically included. The Arduino libary contains many useful functions to control Arduino, and make programming easier. In regular sketches,

#include "Arduino.h"

is automatically added at the top of the sketch before compilation begins.
I have question:
In standard c++, the datatype bool is used for true/false. Why did the Arduino library make boolean, which basically is the same thing?

OK, that did it. Now why can't I initialize an array of that struct in another file?
Command Commands[3];

Again post the error message. You probably forgot to include the header file.

Did we mention to post the error message? And the code? (not just one line)

When initialzing a struct named Command, you do not need to write "Command" after "struct"; only at the end before the semi-colon:

typedef struct
{
  boolean Active;
  char Color;
  int Status;
  int Duration;
} Command;

dkl65:
When initialzing a struct named Command, you do not need to write "Command" after "struct"; only at the end before the semi-colon:

typedef struct

{
  boolean Active;
  char Color;
  int Status;
  int Duration;
} Command;

That creates an anonymous struct. spowers225, may not want to do that.

mkwired:

dkl65:
When initialzing a struct named Command, you do not need to write "Command" after "struct"; only at the end before the semi-colon:

typedef struct

{
  boolean Active;
  char Color;
  int Status;
  int Duration;
} Command;

That creates an anonymous struct. spowers225, may not want to do that.

Notice the typedef? That's the C way of doing what c++ does. They generally only add names when it's a linked list and you need a pointer to it within itself.

In standard c++, the datatype bool is used for true/false. Why did the Arduino library make boolean, which basically is the same thing?

Why did they create "byte" when you have "unsigned char"?

Why do things like "uint8_t" exist?

Short answer: people are never satisfied with what you give them and have to reinvent the wheel to validate their existences.

majenko:
Short answer: people are never satisfied with what you give them and have to reinvent the wheel to validate their existences.

Nope. The two types exist for historical and compatibility reasons...

They exist now for that reason, yes. But they weren't created for that reason, now were they?

WizenedEE:

mkwired:

dkl65:
When initialzing a struct named Command, you do not need to write "Command" after "struct"; only at the end before the semi-colon:

typedef struct

{
  boolean Active;
  char Color;
  int Status;
  int Duration;
} Command;

That creates an anonymous struct. spowers225, may not want to do that.

Notice the typedef? That's the C way of doing what c++ does. They generally only add names when it's a linked list and you need a pointer to it within itself.

I bow my head in shame. You are right.

From the C++98 Spec, Section 7.1.3.5

If the typedef declaration defines an unnamed class (or enum), the first typedef-name
declared by the declaration to be that class type (or enum type) is used to denote the
class type (or enum type) for linkage purposes only (3.5).

typedef struct { } *ps, S; // S is the class name for linkage purposes

This is the error I am receiving as a result of trying to compile an array of struct:

URL_Parser.c:21: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Commands'
URL_Parser.c:30: error: expected '=', ',', ';', 'asm' or 'attribute' before '*' token
URL_Parser.c: In function 'sendCharacter':
URL_Parser.c:46: error: 'Commands' undeclared (first use in this function)
URL_Parser.c:46: error: (Each undeclared identifier is reported only once
URL_Parser.c:46: error: for each function it appears in.)

I am declaring the array this way:
Command Commands[3]; //red = 0, green = 1, yellow = 2

And my Command.h file contains the struct:
#ifndef COMMAND_H
#define COMMAND_H

#include "Arduino.h"
struct Command
{
boolean Active;
char Color;
int Status;
int Duration;
};

#endif

Any ideas?

You can either turn Command into a typedef or you can use the C++ compiler instead of the C compiler. I suggest the latter. Simply rename URL_Parser.c to URL_Parser.cpp and resolve any problems that arise.