[SOLVED] "xxxxxx does not name a type" error message

Hello. I am having difficulty trying to use the ByteBuffer lib. http://siggiorn.com/arduino-circular-byte-buffer/. I am sure it is something simple, and am hoping you can give me a hint…

I downloaded the .zip file, opened it and copied all the contained files into a subdirectoy named “ArduinoByteBuffer” in the …\MyDocuments\Arduino\libraries directory. (WinXP, Arduino 1.0.3)

I then try to compile the example sketch, but get the following error: “ByteBufferExample:8: error: ‘ByteBuffer’ does not name a type”

Here is the sample code (included with the Lib):

#include <ByteBuffer.h>

  Silly program that emulates buffered processing
  using a circular bytebuffer

ByteBuffer buffer;

void setup()
  // Initialize the buffer with a capacity for 256 bytes

  // Init serial just to debug

int cnt = 0;
void loop() {

  // Every 100th update	
  if( cnt%100 == 0 ){
    buffer.put(200);					// Put one byte at end
    buffer.putInt(2000);				// Put one int at end
    buffer.putLong(20000);				// Put one long at end
    buffer.putFloatInFront(200000);	// Put one float at beginning

  // Every 100th update	(20 updates offset)
  if( (cnt+20)%100 == 0 ){
    Serial.println("Received following bytes");
      while( buffer.getSize() > 0 )
        Serial.println(buffer.get(), DEC);

And here is the entire list of error messages I get:

ByteBufferExample:8: error: ‘ByteBuffer’ does not name a type
ByteBufferExample.pde: In function ‘void setup()’:
ByteBufferExample:13: error: ‘buffer’ was not declared in this scope
ByteBufferExample.pde: In function ‘void loop()’:
ByteBufferExample:25: error: ‘buffer’ was not declared in this scope
ByteBufferExample:35: error: ‘buffer’ was not declared in this scope

I tried changing #include <ByteBuffer.h> to #include “ByteBuffer.h”, that did not help. I also tried moving the ByteBuffer lib into the c:\program\arduino… directory, again did not help.

I am sure this is something simple, and would appreciate any pointers.

The library has a nonstandard (for 1.0.3) directory structure: you should move the .cpp and .h files in ...\Arduino\libraries\ArduinoByteBuffer.

That fixed it!

I noticed that in addition to moving the two files up I needed to also remove all the 'extra' directory structures. Just leaving the two files and the example sub directory.

Thank you.

Move the files to...?

Gocht: Move the files to...?

Hello, sorry - I can see the answer above is not really that clear :-)

So, as supplied, the ArduinoByteBuffer.zip file had a complex set of sub-directories, and the two files ByteBuffer.ccp and ByteBuffer.h were located one level down in: *\ArduinoByteBuffers\ByteBuffer*

When I 'installed' the library, it went into the directory: * C:\Documents and Settings\Al\My Documents\Arduino\libraries\ArduinoByteBuffers\ByteBuffer\ByteBuffer.ccp* * C:\Documents and Settings\Al\My Documents\Arduino\libraries\ArduinoByteBuffers\ByteBuffer\ByteBuffer.h*

To solve the problem I moved them up a level to: * C:\Documents and Settings\Al\My Documents\Arduino\libraries\ArduinoByteBuffers\ByteBuffer.ccp* * C:\Documents and Settings\Al\My Documents\Arduino\libraries\ArduinoByteBuffers\ByteBuffer.h*

That seemed to be the key - moving the two files (*.ccp and *.h) out of the subdirectory.

I also noted there was a LOT of extra junk contained in the .zip file, best as I can tell some extra stuff associated with an Apply system? Things like: *\ArduinoByteBuffers\ByteBuffer.snv\prop-base* There were a lot of them, I removed all the extra sub-directories except the one containing the examples. IIRC, I needed to do this cleanup as well as the extra stuff was causing errors as well....

So, bottom line: Moved the .CCP and .H file out of sub-directories, and removed all the 'extra' sub-directories outside of the examples one. That is what I had to do to get it to work. Hope this is a bit more clear and helps anyone who also gets this type of error!


I moved these two files from

Thank you Thomasow that worked for me.

Just a heads up to anyone seeing this error, is sure that they have all the right libraries in the right places, and is pretty sure their class syntax is copacetic:
I was getting this error after writing a very simple LED class (of course it was late at night), and couldn’t figure out why. Everything looked good, yet any reference to the class type borked. The next day, after more careful observation, I found that I had my class header guard statement written as:

#ifdef MyClass
#define MyClass

Once I changed the “#ifdef” to #ifndef", all worked as it should. D’oh! All that angst over one little “n”.
Anyway, it’s something to check, because if you don’t have that “n” in there, the class header never gets processed by the compiler, so your class method definitions make no sense to it, so at the first mention of one your get the “… does not name a type” error.

Oh them typos. Rock on, folks!