Clang and undefined symbols when building a library

后端 未结 3 1606
一整个雨季
一整个雨季 2020-12-08 17:17

I\'m working on a C++ framework, and there\'s a few issues when I compile it on OSX with Clang.

First of, I\'m using some other libraries, such as openssl, and clang

3条回答
  •  盖世英雄少女心
    2020-12-08 17:27

    According to one of the commenters you have to use -lcrypto to prevent the first error.

    The second error seems to be due to an ABI incompatibility of clang and gcc. Rebuild boost with clang++ and libc++. See SO posts Is clang++ ABI same as g++?, Why can't clang with libc++ in c++0x mode link this boost::program_options example? and How to compile/link Boost with clang++/libc++?.

    In case you run into linker troubles with other libraries you should also try to rebuild those with clang++.

    Edit:

    In order to instruct the OS X linker to allow unresolved symbols you should add -undefined dynamic_lookup to the linker options. See also SO post Error when making dynamic lib from .o

提交回复
热议问题