The Order of Linking and Unresolved Symbols

Let's learn what to do when correctly defined symbols go missing without an explanation.

We'll cover the following

A linker can often seem whimsical and start complaining about things for no apparent reason. This is an especially difficult ordeal for programmers starting out who don't know their way around this tool. It's no wonder since they usually try to avoid touching build configuration for as long as they possibly can. Eventually, they're forced to change something (perhaps add a library they worked on) in the executable, and all hell breaks loose.

Dependency chain

Let's consider a fairly simple dependency chain: the main executable depends on the outer library, which depends on the nested library (containing the necessary int b variable). Suddenly, an inconspicuous message appears on the programmer's screen:

Get hands-on with 1400+ tech skills courses.