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

Problems with compiling/debugging libraries...

Hi there!

I'm developing quite a big project using the latest Keil3 IDE C166, so I decided to split up the code into smaller libraries to speed up the compilation. Now there is quite a set of libraries which depend on each other.

For example, ProjectX uses Library2 and Library2 uses Library1. The strange thing is the compilation of Library2. The compiler does not complain about any missing functions, it just shows the following warning:

LIBRARY2.C(138): warning C140: 'TestFunction' undefined; assuming 'extern int TestFunction()'

In the example above the function "TestFunction" does not exist in Library1. So why doesn't the compiler throw a compilation error on me?

The next problem to solve is the c-source-level debugging of library code. In a different thread I found the "SET SRC = Path" command to be entered in the debug command window, so that the debugger searches in the specified path for the concerning library source files. This would be ok but the source codes of each library is placed in a different location.

Is there a way to automatically provide the source path for each library source code or do I have to enter the source path by using the "SET SRC = " command each time I would like to debug it?

Thanks in advance,
Axel.

Parents Reply Children
  • You are right about the linker. But in my case are the function prototypes missing. Shouldn't the compiler complain about that?

    I should and it does
    LIBRARY2.C(138): warning C140: 'TestFunction' undefined; assuming 'extern int TestFunction()'

    Erik


  • I should and it does
    LIBRARY2.C(138): warning C140: 'TestFunction' undefined; assuming 'extern int TestFunction()'


    Hmmm. Why do you say "should"? Is it a standard in the ANSI-C convention? The microsoft compiler, for example, throws the following error:

    d:\Projects\Test\Library2.c(66) error C3861: 'TestFunction': identifier not found, even with argument-dependent lookup

    Is it possible that creating a library does not include linking with dependent libraries (in my case Library1)?

    Axel.

  • Hmmm. Why do you say "should"? Is it a standard in the ANSI-C convention? The microsoft compiler, for example, throws the following error:
    Any compiler I know of will "report" that a function is not prototyped/defined in the module. The "standard" is somewhat fuzzy on error/warning reporting and the only program I know of, that will faithfully report everything that is suspicious is PClint.

    Is it possible that creating a library does not include linking with dependent libraries (in my case Library1)?
    Sure, if you screw around with directories and such; However any library that is properly identified (e.g. O:\p\q\r\lib1.lib) in the linker command string will be examined for resolution of unresolved externals.
    One little caveat: if you have 2 assembler modules with different filenames and identical NAME () identifiers, you will see "funny stuff". I do not know of a way to create the same in C, but with my luck I'll find it some day.

    Erik

  • "The "standard" is somewhat fuzzy on error/warning reporting"

    On the contrary, the standard is quite explicit about when a diagnostic is required. Any fuzziness you may be experiencing is therefore your own problem.