I am compiling a project using uvision4 and it compiling right, but when its start linking it gives me an error
Build target 'Target 1' assembling Startup.s... compiling hello.c... C:\Keil\ARM\INC\Luminary\lm3s6918.h(2808): warning: #47-D: incompatible redefinition of macro "SYSCTL_RCC_XTAL_M" (declared at line 487 of "C:\Keil\ARM\INC\Luminary\hw_sysctl.h") linking... hello.axf: Error: L6218E: Undefined symbol FlashUserGet (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol Formike240x320x16_ILI9320BacklightOn (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol Formike240x320x16_ILI9320Init (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrCircleDraw (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrContextInit (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrRectDraw (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrRectFill (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrStringDraw (referred from hello.o). hello.axf: Error: L6218E: Undefined symbol GrStringWidthGet (referred from hello.o).
I have included the libraries it compiles but it doesn't finde the object files....
Need help...
No - Evidently you haven't!
Note that #including a header file in your 'C' source does not give you the library...
I have include then on menu option of the target on the tab C/C++. Before i include them it was giving me another errors, it wasn't compiling, but when i include then it compiles but didn't linker. I think that is because of the object files of the other librarys that it doesn't know.
No. Including "include" (header) files (xxx.h) is needed to stop getting compilation errors.
Adding library files (*.a or *.lib or sometimes just *.o) is needed to stop getting linker errors.
The header file just tells the names and data types of symbols available in a library. That is enough for the compiler to make references to these symbols.
But the linker can't be happy to just know the existence of a symbol. It needs the library or object file that reserves room (and initial value) for a variable or that contains the actual implementation of a function.
You may have to bother a bit with the Linker tab, or with adding a library to the project tree, if you want to make the linker happy.
I have have included included all *.o files that i make and then i add them but it gives me another error.
assembling Startup.s... compiling hello.c... C:\Keil\ARM\INC\Luminary\lm3s6918.h(2808): warning: #47-D: incompatible redefinition of macro "SYSCTL_RCC_XTAL_M" (declared at line 487 of "C:\Keil\ARM\INC\Luminary\hw_sysctl.h") linking... hello.axf: Error: L6242E: Cannot link object adc.o as its attributes are incompatible with the image attributes. hello.axf: Error: L6242E: Cannot link object can.o as its attributes are incompatible with the image attributes. hello.axf: Error: L6242E: Cannot link object comp.o as its attributes are incompatible with the image attributes. hello.axf: Error: L6242E: Cannot link object cpu.o as its attributes are incompatible with the image attributes. hello.axf: Error: L6242E: Cannot link object epi.o as its attributes are incompatible with the image attributes. hello.axf: Error: L6242E: Cannot link object ethernet.o as its attributes are incompatible with the image attributes.
On the libraries there is a makefile, the generate the *.o files, i did de command make. i insert them on the project but i didn't work.
I want to know if there is any way to generate the *.o files from the *.h and *.c in keil uvision4.
The way to create *.o or *.obj files from *.h and *.c or *.cpp files is called compilation.
Yes, Keil does include a compiler.
No, you do not need to specifically add the object files to the project - the tools already knows that the compiler should take *.c or *.cpp files anc reate object files, and that these object files should be sent to the linker.
It's only when someone gives you either binary library file or object file and a couple of header files, that you need to add these library or object files.
Your own object files from your own compilation does not contain the implementation of the functions from a third-party library. So adding your own object files to the project will not help. You need to add the library file itself to the project.
The object files created from your source files contains references "want to call function x".
The object files hidden within the library (a library is basically a container with one or more object files - i.e. the output from compilation *.c or *.cpp files). But these objects contains "the description of what to do when someone calls function x".
This doesn't have anything to do with embedded programming. It's the same thing when developing on a PC. Any decent book on C programming should explain the build process - conversion of C/C++ files into object files. And linking of object files + optional library files into executables.
Thanks for the help... It's working now.