Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Undefined reference to Function
Undefined reference to Function [message #1073862] Thu, 25 July 2013 16:45 Go to next message
Christian Lorei is currently offline Christian LoreiFriend
Messages: 1
Registered: July 2013
Junior Member
Hi, I just try to use Eclipse CDT Juno mspgcc and it works. But if i try to use some 3rd party Libraries I got the Error undefined reference to `lcd_init'. lcd_init is declared in dsiplay.h and defined in display.c.
The Headerfile is Included to my project (Project > Property > C/C++General > Path and Symbols > Add... > File System.. Path to the 3rd party Libraries)

So if I use #include "display.h" there is no error, when I debugg the code. If I call lcd_init() in the main() or any other functions out of the dsiplay.h-File I get the undefined reference Error to the functions.
When I also include the display.c file (#include "display.c") i got other Errors. Depending to display.c because the compiler miss some other Functions which are defined / declared in other C-Files.

So my question is how can I told Eclipse to include the C-Files from the 3rd party Folders.

Thanks
Chris
Re: Undefined reference to Function [message #1073954 is a reply to message #1073862] Thu, 25 July 2013 20:47 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1348
Registered: July 2009
Senior Member
When you use libraries, there are generally two things you have to deal with. One is the include file defining the API to the library. The other is the actual library itself that has to be made available to the linker portion of the build. You seem to have accomplished locating and using the include file. You need to add the library to the list of libraries to pass to the linker.
Re: Undefined reference to Function [message #1074150 is a reply to message #1073954] Fri, 26 July 2013 07:43 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1967
Registered: July 2009
Senior Member
You have to tell the linker about the library.
http://wiki.eclipse.org/CDT/User/FAQ#Adding_C.2FC.2B.2B_External_Libraries


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Why is there no Index import but only index export?
Next Topic:Linux kernel indexing - Makefiles
Goto Forum:
  


Current Time: Sun Nov 23 17:27:17 GMT 2014

Powered by FUDForum. Page generated in 0.01732 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software