Skip to main content


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: 1445
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 messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
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
Re: Undefined reference to Function [message #1508645 is a reply to message #1074150] Fri, 12 December 2014 15:42 Go to previous message
Schawn Thropp is currently offline Schawn ThroppFriend
Messages: 1
Registered: December 2014
Junior Member
Thanks for the answer and links, however I tried this and it still does not work. I am trying to link in to Eclipse the OpenCV libraries for a sample project I am building, however I keep getting several erros like:
undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)



Using Eclipse Luna
1. I went into Project Properties -->C/C++ Build/Settings
2. Under Cygwin C++ Linker / Libraries --> Library Search Path (-L), I added the directory to where my .dll files are for opencv
3. Under Cygwin C++ Linker / Libraries --> Libraries (-l), I add all of the opencv dll files (leaving off the .dll file extension).
4. Did a Project --> Clean
5. Project --> Build All and I get the errors referenced above (quite a few of them)

Any other suggestions to figure out why this is happening?
Thank you.
Previous Topic:Sh.exe file SDCC plugin crash
Next Topic:Toolchain development
Goto Forum:
  


Current Time: Fri Apr 19 09:51:22 GMT 2024

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

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

Back to the top