Report
4 months, 1 week ago.

error in compiling mbed in keil uvision4

for the first time i want to use mbed library in my project on LPC1768, actually i want to run OV7670 Camera module, so in main program i have to include "mbed.h" and i have copy other header file in main folder of my project on keil4. i faced some error and i had solve them, but the i had face the above error for FileHandle.h and DirHandle.h and also Base.h and also other error that related to these header file. i don' whether it's a good idea to list them down here or not, but i list them here. I use Keil4 for this project.

Build target 'Target 1'
assembling startup_LPC17xx.s...
compiling Main.c...
FileHandle.h(18): error:  #20: identifier "namespace" is undefined
FileHandle.h:   namespace mbed { 
FileHandle.h:   ^
FileHandle.h(18): error:  #65: expected a ";"
FileHandle.h:   namespace mbed { 
FileHandle.h:                  ^
FileHandle.h(41): warning:  #12-D: parsing restarts here after previous syntax error
FileHandle.h:       virtual ssize_t write(const void* buffer, size_t length) = 0;
FileHandle.h:                                                                   ^
FileHandle.h(48): error:  #77-D: this declaration has no storage class or type specifier
FileHandle.h:       virtual int close() = 0;
FileHandle.h:       ^
FileHandle.h(48): error:  #65: expected a ";"
FileHandle.h:       virtual int close() = 0;
FileHandle.h:               ^
FileHandle.h(59): error:  #757: variable "virtual" is not a type name
FileHandle.h:       virtual ssize_t read(void* buffer, size_t length) = 0;
FileHandle.h:       ^
FileHandle.h(59): error:  #101: "ssize_t" has already been declared in the current scope
FileHandle.h:       virtual ssize_t read(void* buffer, size_t length) = 0;
FileHandle.h:               ^
FileHandle.h(59): error:  #65: expected a ";"
FileHandle.h:       virtual ssize_t read(void* buffer, size_t length) = 0;
FileHandle.h:                       ^
FileHandle.h(68): error:  #77-D: this declaration has no storage class or type specifier
FileHandle.h:       virtual int isatty() = 0 ;
FileHandle.h:       ^
FileHandle.h(68): error:  #65: expected a ";"
FileHandle.h:       virtual int isatty() = 0 ;
FileHandle.h:               ^
FileHandle.h(80): error:  #757: variable "virtual" is not a type name
FileHandle.h:       virtual off_t lseek(off_t offset, int whence) = 0;
FileHandle.h:       ^
FileHandle.h(80): error:  #101: "off_t" has already been declared in the current scope
FileHandle.h:       virtual off_t lseek(off_t offset, int whence) = 0;
FileHandle.h:               ^
FileHandle.h(80): error:  #65: expected a ";"
FileHandle.h:       virtual off_t lseek(off_t offset, int whence) = 0;
FileHandle.h:                     ^
FileHandle.h(89): error:  #77-D: this declaration has no storage class or type specifier
FileHandle.h:       virtual int fsync() = 0;
FileHandle.h:       ^
FileHandle.h(89): error:  #65: expected a ";"
FileHandle.h:       virtual int fsync() = 0;
FileHandle.h:               ^
FileHandle.h(91): error:  #757: variable "virtual" is not a type name
FileHandle.h:       virtual off_t flen() {
FileHandle.h:       ^
FileHandle.h(91): error:  #65: expected a ";"
FileHandle.h:       virtual off_t flen() {
FileHandle.h:                     ^
FileHandle.h(102): warning:  #12-D: parsing restarts here after previous syntax error
FileHandle.h:   };
FileHandle.h:    ^
FileHandle.h(104): error:  #169: expected a declaration
FileHandle.h:   } // namespace mbed
FileHandle.h:   ^                 ^
Main.c: 6 warnings, 30 errors
Target not created
Comment on this question

1 Answer

4 months ago.

Hi Mahdi,

Keil Uvision 4 is used for compiling C code, however namespace is a C++ keyword so that's why you have this problem.

You must use mbed export to create keil project for your building. You can refer here https://os.mbed.com/docs/mbed-os/v5.11/tools/exporting.html.


To post an answer, please log in.