10 years, 7 months ago.

Compiler Error 262

Can't find any informations about Compiler Error 262, does anyone solved problems with this Error ???

The description of the Compiler is "Not a class or struct name"

3 Answers

10 years, 7 months ago.

Good you at least put the error description there (unlike the previous one with the error). Would be even better to also post the code where you are getting the error.

You are doing something where the compiler expects the name of a class, and it doesn't get it. Several options where you can get that, most give a slightly different error. I found at least one option where you get this specific one, but there might be more:

If you make a child class that inherits another class, and you misspell the name that it inherits from, you get this error. But if you have another situation, post the code!

10 years, 7 months ago.

Thank you, for your fast answer.

I use the following programm as basis. Just with this code the compiler work perfectly. I copied the code in my own programm an there it doesn't work.

https://mbed.org/users/okini3939/code/bmp085_lib/file/1d88eb9f5bbd/

The "BMP085.h" is in main.cpp included and the pins are also known with "BMP085 bmp085(p9, p10);"

Every is the same as in the basis programm but I geht always the same error message.

----------------------

  1. include "mbed.h"
  2. include "BMP085.h"
  3. include "Display.h"

BMP085 bmp085(p9, p10);

int main() {

bmp085.update();

float altitude = 0.0; float p0 = 1013.25; float value = 5.255; float p = bmp085.get_pressure();

while(1) { altitude = (288.15/0.0065)*(1-pow((p/p0), 1/value));

display_pressure(bmp085.get_pressure()); display_temp(bmp085.get_temperature()); display_altitude(altitude); }

}

-------------

sorry but I dont know how to format it correct :-)

Use <<code>> and <</code>> to format code (not on the same line as your code)

Anyway the issue is indeed inheritance: If you double click the error it will jump to the location of the error:

class BMP085 : public Base {

Which is there. The reason it works when you import the sample program and not when you try it yourself, is that the sample program uses an olders version of the mbed library. The Base class has been removed since then. Just delete that part and I think it works fine with newer mbed lib:

class BMP085 {

Or use another library, for example: http://mbed.org/users/tylerjw/code/BMP085/

posted by Erik - 22 Aug 2013

YEAH!!! MANY MANY THANKS!

It works perfectly! I never would have thought of it!

I'll have a look on the other library!

Once again many thanks an have a nice evening! :-)

posted by Stefan Lange 22 Aug 2013
8 years, 9 months ago.

I am getting the same error when I compile the illustrative USBKeyboardMouse code.

This cpp file includes USBDC.h (the device controller) and during compile reports that on Line 18, "class usbdc : public Base" is not a class or struct name. Since this file is including MBed.h, this tells me that someone updated Mbed.h and did not include this class.

Anyway to get around this ?