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

Multiple c files linking problem

Hi everyone !

I have basic knowledge of c programming. I want to write a multiple c file project due to many functions in my program.
so, i started to learn how to write learn multiple file program in c.

here is the example of three files which i compiled and tested on Dev-cpp compiler.it gives me the output 3.
(I used Dev-cpp to learn how to write multiple c files).

main.c file :

#include <stdio.h>
#include "other.h"

int main (void)
{
    printf("%d\n", getfavoritenumber());
    return 0;
}

other.h

#ifndef _OTHER_H_
#define _OTHER_H_

extern int getfavoritenumber(void);

#endif

other.c

#include "other.h"

int getfavoritenumber(void)
{
    return 3;
}

Now i same code i tested in keil. this gives following :

Build target 'Target 1'
compiling main.c...
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: GETFAVORITENUMBER MODULE: main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: GETFAVORITENUMBER MODULE: main.obj (MAIN) ADDRESS: 0010H
Program Size: data=11.0 xdata=0 code=23
"test" - 0 Error(s), 2 Warning(s).

I don't know what to do? Please Help...

0