Keil Logo

Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Cristian CLC
Posted
23-Sep-2014 17:58 GMT
Toolset
ARM
New! Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Hi everybody, i am trying to use the OpenCv's libraries with keil and i ve done this:
1. Added a Group called libs where i ve put al the .libs files
2. In the project configuration added all the necesary include paths ( and even more just in case ). libraries, sources, and .h paths

I have created a simple project, which compiles and works perfect without using Opencv libs

But when i try to use this libs i get this error:

Error: L6218E: Undefined symbol cvWaitKey (referred from main.o).

(CvWaitkey is defined in highgui.h which is included at the top of the main file)

It seems preety obvious that the compiler doesnt know where is defined cvWaitKey but i dont know what i am doing wrong because i ve ensured to include the highgui.h in the main file and added the include path in the project configuration.

Any idea?

Thanks!

here u have a print screen:
http://www.mediafire.com/convkey/f42e/8c7v7kmakvi2f5mfg.jpg

Read-Only
Author
Per Westermark
Posted
23-Sep-2014 18:31 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

The header file informs the compiler that there exists a function with that name. And tells the compiler what parameters the function takes and what data type it returns.

The next question here: have you told the linker what libraries to include, so the linker will be able to locate the actual processor instructions that implements that function?

Read-Only
Author
Cristian CLC
Posted
23-Sep-2014 20:55 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Thanks for answering Per. Your are right, I havent told the linker what libraries to include.
I suppose that can be done via project options - linker
but i cant find the way.

Read-Only
Author
Westonsupermare Pier
Posted
23-Sep-2014 21:23 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Well if you dropped/added them to the project, then the linker should find them that way, presuming of course they are in a suitable/expected format.

Read-Only
Author
Per Westermark
Posted
24-Sep-2014 03:33 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Sometimes expects a helper function or two to be written by the user, in which case the function gets mentioned in the header files but there are no implementation.

But in that case that should be well documented.

Read-Only
Author
Cristian CLC
Posted
24-Sep-2014 19:17 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

I´ve wrote some dummy code for the function cvWaitKey and the code compiles perfect.

But i still can´t understand what is happening.
The implementation code should be alocated in the .lib files
and the libs are added to the project.

In the linker options i dont have any way to add the .lib path
Maybe (as you said) once the libs are added to the project the linker should find the way to vinculate this libs to the project.

I really appreciate your help Per

Best regards

Read-Only
Author
Per Westermark
Posted
24-Sep-2014 20:09 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

You shouldn't need to specify any library path because when you add a library to the project you specifically browse to the directory where the *.lib file is and points at the file.

And if you later browse the project, you can open the properties for the individual files and will then see a fully qualified file name for each source file or library file.

It's only for header files that you need to supply a path, since header files aren't part of the project - they are scanned for when the compiler processes the source files.

But might you have missed to add one library?

Read-Only
Author
Cristian CLC
Posted
24-Sep-2014 20:29 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

I have added all the necessary libraries but I am not sure if they are suitable for this ide.
I mean this libs were created for visual studio 2005 and now i am tring to use them in keil.

Read-Only
Author
Per Westermark
Posted
24-Sep-2014 20:38 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Libraries are only possible to use if they has the correct file format, and are compiled for the correct processor and is compiled to use the same ABI (Application Binary Interface).

And if the library has hardware dependencies then it must also be compiled for the correct hardware platform.

That is a reason why lots of libraries are distributed in source form, so the user can rebuild the libraries using the correct compiler tool chain and after having configured the source code to match the used hardware platform.

Read-Only
Author
Cristian CLC
Posted
24-Sep-2014 21:20 GMT
Toolset
ARM
New! RE: Error: L6218E: Undefined symbol cvWaitKey (referred from main.o)

Really thanks for your help, now i have to figure out what should i do to create my own libraries.

Read-Only
Author
Andy Neil
Posted
25-Sep-2014 20:46 GMT
Toolset
None
New! RE: now i have to figure out what should i do to create my own libraries

Why not just use the source files directly? Why use libraries at all?

Read-Only
Author
Cristian CLC
Posted
25-Sep-2014 21:18 GMT
Toolset
None
New! RE: now i have to figure out what should i do to create my own libraries

I´ve been working with the source files and it´s not as easy as it seems, several functions depend of several files.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.