10 years, 3 months ago.

Unable to compile #include "mbed.h"

I'm trying to create a new file for an LPC1768 program but when compiled results in many errors, e.g.,

Error: Identifier "namespace" is undefined in "extras/mbed_dc225afb6914/DigitalIn.h", Line: 23, Col: 2 Error: Expected a ";" in "extras/mbed_dc225afb6914/DigitalIn.h", Line: 23, Col: 16 Warning: Parsing restarts here after previous syntax error in "extras/mbed_dc225afb6914/DigitalIn.h", Line: 85, Col: 16

etc.

I've commented everything in the file except the #include "mbed.h" statement and the errors are still generated. The program would compile before I added the new file.

What might be wrong here?

I have a similar error and no idea to solve it. Filename is cpp.

Error: Identifier "namespace" is undefined in "extras/mbed_8a40adfe8776/DigitalIn.h", Line: 23, Col: 2

#include "mbed.h"
#include "graphics.h"
#include "EaEpaper.h"
#include "Arial28x28.h"
#include "Arial12x12.h"
#include "font_big.h"

//DigitalOut myled(LED1);

EaEpaper epaper(PTD13,            // PWR_CTRL
                PTA5,             // BORDER
                PTA12,            // DISCHARGE
                PTD5,             // RESET_DISP
                PTA4,             // BUSY
                PTD0,             // SSEL
                PTC9,             // PWM
                PTD2,PTD3,PD1,    // MOSI,MISO,SCLK
                PTE0,PTE1);       // SDA,SCL 
 
int main() {

    epaper.cls();
    epaper.set_font((unsigned char*) Arial28x28);  // select the font
    epaper.locate(5,20);
    epaper.printf("Hello Mbed");
    epaper.rect(3,15,150,50,1);
     
    epaper.set_font((unsigned char*) Arial12x12);
    epaper.locate(5,60);
    epaper.printf("small Font");
    epaper.set_font((unsigned char*) Neu42x35);
    epaper.locate(5,70);
    epaper.printf("big Font");
    
    epaper.write_disp(); // update screen
    
    wait(5);
    epaper.fillcircle(180,30,22,1);
    epaper.circle(160,150,20,1);
    epaper.write_disp(); // update screen
   
}

posted by Robert Fischer 07 May 2014

Thanks. I have the same problem solved.

posted by Mohd Salleh 30 Aug 2018

2 Answers

10 years, 3 months ago.

I found the problem, the filename extension was "c" instead of "cpp".

Accepted Answer
10 years, 1 month ago.

Thanks. Solved the same problem for me.