Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years ago.
LPC11U24 - problem with header and C file organization?
I have some problem trying to organize C and header file for my project. I use mbed LPC11U24, and mbed library is updated to latest version. In the top right corner i selected mbed LPC11U24 platform.
In my project for example i have 3 files and i want to turn on and off LEDs :
1. main.cpp 2. header_extern.c 3. header_extern.h
1. main.cpp file contains code:
2. header_extern.c file contains code:
3. header_extern.h file contains functions prototype:
The main problem is when i use separated c and header files and try to compile it a got lots of errors. If i try to organize all code in one file (main.cpp) everything work perfect. Why this happend? Why i can't call functions which are defined in header_extern.c from file main.cpp? Should i use same older mbed library and which one?
this picture show compile errors:
1 Answer
10 years ago.
Copy pasting code and using <<code>> and <</code>>
is easier than making a picture, both for you and for us.
I think your problem is the name if the extra .c file, and to be specific, that it is a .c file. Those files are compiled as C, and not as C++. And you do use the mbed library, which is C++ code. And that goes wrong.
Rename the file to .cpp and it probably works.