9.2 I’m using ChemApp on a Unix system and I get several “undefined symbol” errors during linking, what to do?

The undefined symbols reported by the linker usually start with one or two underscores, and reported to be first referenced in the ChemApp library. This happens during the linking of any ChemApp application program, even the demo programs (e.g.cademo1) included with the ChemApp distribution.

Solution: The cause of this error is typically related to the installation and setup of the compiler you are using. The undefined symbols are normally to be found in object files and libraries other than ChemApp or the application program’s. The linker looks for them in system libraries installed on your computer. The reason why the linker isn’t successful is typically because these libraries are not installed, their location is unknown to the linker, or the libraries are not suitable for the version of the compiler/linker you are using.

To track down the reason for this problem, you might want to take the following steps:

  • Add the proper option to the linker command line so that it produces verbose output. This option is often-v. This should reveal the real, complete linker command line. Identify the libraries and object files it tries to access during the linking process, and the directories it searches for these files. Check if all of the libaries and object files are actually present in these directories. If not, the compiler installation or update process was likely incomplete. 
  • Check the version of your compiler and verify with your system administrator that the matching system libraries are present in the proper directories. One typical clue is that the system libraries, if they are compiler version-dependent, are often located in subdirecties whose names reflect the version of the compiler. 
  • If you are using shared libraries, check if the environment variable pointing to the directories to search for these shared libraries (typically calledLD_LIBRARY_PATH) is properly set.