Go Down

Topic: " 'String' does not name a type" in header file (Read 1 time) previous topic - next topic

Nate711

I am trying to create a class, but it keeps telling me 'String' does not name a type! Is this problem because it is a header file (.h)? Thansk.

Code: [Select]
#define VALUECAP 6

class osc {
public:
  String _message;
  float values[VALUECAP];
};

WizenedEE


Nate711

Thanks. It fixed my problem. What exactly does including wprogram do?

James C4S


Thanks. It fixed my problem. What exactly does including wprogram do?


If you look at the actual files, WProgram.h includes WString.h, which defines String.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Nate711

OK, but why do .pde's not need that include? I'm no expert at C btw.

WizenedEE

The arduino IDE sticks some things into your code before it sends it to the compiler.

If you're interested in exactly what it does, you can hold shift while compiling to get a verbose output. This will show exactly what functions it calls. It also gives a path to where the temporary files are (they're only there until you hit the upload button), where you can look at everything. The "yoursketch.cpp" file is the "post-arduino processed" file that is sent to the compiler. It includes "#include<WProgram.h>" and then declarations for all the functions you defined (they look like "void loop();")

Go Up