Re: how to find necessary library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Uwe,

> I need to know which include/used function needs which library?

Yes, that is correct.

If you use the symbols from NCurses (and its #include's) in your source
code, you need to specify -lncurses (for libncurses.a) on your link line.

> There is no way in the auto(tool chain) to find automatically the
dependencies?

Automatically... no.

You can use grep for include preprocessor directives.

You can look at the missing symbols that the linker indicates, and use that
as a clue as to which libraries are missing.

You can use tools like ldd or nm or otool to look at symbols in executables,
object files and libraries.

If this seems a bit archaic, brittle, and/or arcane, I agree.  The tools
were devised in the era of much smaller machines, and the programmer was
expected to know what libraries he was pulling into his project.

It's a pain point, no doubt.  And the solutions I've seen just moved the
brittleness around.

Solutions that actually solve the problem involve moving entirely to a new
language and IDE.

I'm a C++ guy through-and-through who uses Vim as my IDE, but I've had a
very pleasant excursion with Java using the Eclipse IDE.  In some problem
domains, Java is the best tool of choice (in my humble opinion) -- such as
enterprise software (J2EE).

But that is a rather drastic solution, and may-or-may-not be an option.

Sincerely,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux