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

Unresolved external

I started a new project with an LPC2106 cpu.
There are two files in it: blinky.c and time.c
In Blinky.c I declare:

extern void init_time(void);

And call it in the main function.
Function is written in time.c

When I link I get a undefined symbol report on init_time

If I look at blinky.lst I can see a call to a external symbol called: "Z9init_timev"
And if I look at time.lst I can see a global symbol "init_time"

Anyone know what I am doing wrong???

Parents
  • Your problem is the name of the blinky.c source file. It's actually in all upper-case: BLINKY.C. Now the Keil ARM tools are based on GNU compilers, which are Unix-born, and thus do care about the case of filenames. From GCC's point of view, "BLINKY.C" is a C++ file name, and so it compiled the source as C++. C++ puts a lot more information into a function's linker-visible name than C (google:"name mangling"), which break direct link compatibility with C. Thus your problem.

    Proposed solution: remove BLINKY.C from the project, rename the file to lower-case, and add it back to the project under the new name.

Reply
  • Your problem is the name of the blinky.c source file. It's actually in all upper-case: BLINKY.C. Now the Keil ARM tools are based on GNU compilers, which are Unix-born, and thus do care about the case of filenames. From GCC's point of view, "BLINKY.C" is a C++ file name, and so it compiled the source as C++. C++ puts a lot more information into a function's linker-visible name than C (google:"name mangling"), which break direct link compatibility with C. Thus your problem.

    Proposed solution: remove BLINKY.C from the project, rename the file to lower-case, and add it back to the project under the new name.

Children
No data