LPC43xx MCU C++ Linker: Undefined reference to ...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC43xx MCU C++ Linker: Undefined reference to ...

624 Views
xpressoguy
Contributor I

Hello,

I'm trying to get my first project compiled. main() function with a call to a simple, non fancy GPIO function, void GPIO_function( void ) in file GPIO_test.c. Header file included as #include "GPIO_test.h". Include path added via the project properties "Paths and Symbols". I copied the file GPIO_test.c in the /src folder of the project. I can insert the function with code completion in the source code. BUT I get an undefined reference to `GPIO_function()' error from the linker. Any hints are highly appreciated!

Many thanks and greetings

XpressoGuy

Tags (1)
0 Kudos
1 Reply

383 Views
lpcxpresso_supp
NXP Employee
NXP Employee

From the thread title, it sounds like you are creating a C++ project, but in the body of your post your GPIO function appears to be defined in a .c file. I therefore suspect you have a C vs C++ linkage issue and will need to use extern "C" { .... }  appropriately.


For more details, please see you favorite C++ text book, alternatively an internet search will bring up lots of useful links - for example:
http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B#Linking_C_and_C.2B.2B_code

Regards,

LPCXpresso Support

0 Kudos