Main Site Documentation

Expected constructor, destructor, or type conversion before * token


#1

In the code below, i’m trying to output a reading from the light sensor every two seconds. However, when verifying the build, I get the message “expected constructor, destructor, or type conversion before * token”. What is wrong and how do I fix it?

#include <Wire.h>
#include <SPI.h>
#include <Gadgeteering.h>
#include <LightSense.h>

#include <Mainboards/FEZMedusaS12.h>

using namespace gadgeteering;
using namespace gadgeteering::mainboards;
using namespace gadgeteering::modules;

fez_medusa_s12 board;
light_sense* my_light;

void setup() {
Serial.begin(9600);
my_light = new light_sense(3);
}

void loop() {
Serial.println(lightSense->read_percentage());
delay(2000);
}


#2

Where is lightSense defined?

Serial.println(lightSense->read_percentage());


#3

You need to include Modules/LightSense.h, not LightSense.h. And you are using the wrong variable name on your Serial.println statement.