Original article: Missing undefined reference to 'error. The library function cannot be found. Main. c :(. text + 0x15): Undefined reference to 'memorycontextinit () 'main. c :(. text + 0x26): Undefined reference to 'memorycontextdestory () 'can be compiled using gcc. In fact, the Code is not an object-oriented C ++ language, and I didn't think of it as a problem where c ++ calls C functions. At first, the path of the database is incorrect; the database sequence in the make file is incorrect; and other methods have no effect. The extern "C" problem was discovered only after a hundred attempts. You can use g ++ to compile C's library functions. The target file. O can be generated, but the C ++ naming mechanism has changed the name of the called library function. It must be added with the extern "C" before the C library function ". If one function is converted one by one, it is feasible to extern "C" memorycontextinit (); however, to be able to perform a full conversion, you can change the header file reference of the entire library to the following method: extern "C" {# include ".. /lib/libxxx. h.