This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem when .c file is directly included in another file using #include

I have a Keil uv2 project which has two .c files namely main.c and add.c. The file main.c has function main. The add.c file has definition of function add. In main.c I included add.c using include statement like

#include "add.c"

Since .c file is directly included in main.c, the .M51 file generated by BL51 linker shows only one module detail, i.e. MAIN. Line number to hexaddress map information for add function is put under MODULE MAIN. Because of this I am facing problem in getting module info for add function correctly.
Instead of including .c file directly, if include .h file having just declaration of add function, the .M51 file will have correct information. it will have two MODULE details block one each for MAIN and ADD.
Can anyone has solution for this problem? Is there any settings I need to do to get correct function to source file linking information.

0