5

anyone can help me?? my board is LPC1768 and the sensor is BMP180

Rebuild target 'Target 1'
compiling BMP180.c...
compiling I2C.c...
assembling startup_LPC17xx.s...
compiling system_LPC17xx.c...
compiling GPIO_LPC17xx.c...
compiling PIN_LPC17xx.c...
linking...
.\Objects\asdsa.axf: Error: L6218E: Undefined symbol main (referred from __rtentry2.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 1 error messages.
".\Objects\asdsa.axf" - 1 Error(s), 0 Warning(s).
Target not created.

7 Answers 7

3

I found the solution is easy, but before going deeper into the solution, keep in mind that C compilation unit (C Compiler and Assembler at least) compiles each pure C source file after resolving necessary pre-processor directives, and generates a relocatable object file as a result of compilation.

After the compilation unit does its job, there is another unit that is responsible for combining individually every source file that is compiled successfully into the relocatable form of one big object file for all. This unit is called Linker and the operation is called Linking

A very important feature in relocatable object file is that what is called variable, function will be noted as symbol so far. The linker has to solve the symbols, defining what is originally defined in an object file, reference what is being used in another to their original object file.

After this motivation, now we can call main() function as main() symbol.

I Found that the problem is because the source file that contains the main() function was not compiled. As a result, there is no a relocatable object file that contains the symbol corresponding to main() function. Hence, the compiler is complaining: you asked me to use (reference) a symbol you guaranteed to be found (defined) in another file but I found no such symbol!

The solution:

For Kiel IDE, to queue a source file for a compilation; you gotta shortlist it in the category "Source Group",by clicking right, either adding new files to group, or existing files to group. It will result in something like the following figure:

source that contains *main* function must be added to Source Group category in Keil IDE

Now we have a main function, is turned (defined) to main symbol later, and found by the linker to reference it to whatever use it in any other relocatable object files.

0

I solved this problem with the following steps;

  1. Delete your old project and create new project
  2. Choose true library from Manage Run Time Environment like so: Manage Run Time Environment
  3. Configure "Options for Target" segment. Define symbol USE_STDPERIPH_DRIVER and define project path like so: Options for Taget
  4. Test your configuration. Please write the following code:

     #include "stm32f10x.h"                  // Device header
    
     int main() {
     }
    
0

I had the same issue. The problem was that the function name in .c file had a different name with the one in the .h file, and I didn't know.

0

just add your c file (ex: 'main.c') to the source group (ex: 'source group 1') by expanding the target then right click on the source group, choose add existing files to group 'your source group', then choose the main.c file.

-1

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/14222.html This should help. Just create a dummy main() or main.c file. Linker can't find it in your pjt.

-1

For solution only add this file C to driver folder and translate it, enter image description here

-1

Solved: This "Target Not Created" Issue was Resolved by the setting of Run Time Environment as shown in below(url) image.https://i.stack.imgur.com/kJ4IL.jpg ( consisting of CMSIS and Device supporting components in Run time environment)

{   compiling TransformFunctions.c...

linking... Program Size: Code=768 RO-data=320 RW-data=4 ZI-data=612
FromELF: creating hex file... ".\Objects\LPC1768_B_T.axf" - 0 Error(s), 0 Warning(s). Build Time Elapsed: 00:00:07 }

1
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review Mar 26, 2022 at 6:51

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.