1

我正在尝试使用数论库 (NTL) 进行一些研究。我一直在使用 g++ 编译器,直到我意识到我需要使用 C++ 随机库(它显然不包含在 g++ 中)。所以我然后切换到使用以下参数(带输出)使用 clang++ 进行编译。如果我不包含随机库(但显然我需要它来实现某些功能),它可以与 g++ 一起使用。

clang++ -Wall -O3 -std=c++11 -stdlib=libc++   -c -o Multimap.o Multimap.cpp
clang++ -Wall -O3 -std=c++11 -stdlib=libc++   -lgmpxx -lgmp -lntl -lm main.cpp Multimap.o -o ggh
Undefined symbols for architecture x86_64:
  "std::basic_ios<char, std::char_traits<char> >::operator!() const", referenced from:
      std::istream& NTL::operator>><NTL::ZZ_p>(std::istream&, NTL::Vec<NTL::ZZ_p>&) in libntl.a(ZZ_pX.o)
      NTL::operator>>(std::istream&, NTL::ZZ&) in libntl.a(ZZ.o)
      std::istream& NTL::operator>><NTL::ZZ>(std::istream&, NTL::Vec<NTL::ZZ>&) in libntl.a(ZZX.o)
      std::istream& NTL::operator>><NTL::zz_p>(std::istream&, NTL::Vec<NTL::zz_p>&) in libntl.a(lzz_pX.o)
  "std::istream::get()", referenced from:
      std::istream& NTL::operator>><NTL::ZZ_p>(std::istream&, NTL::Vec<NTL::ZZ_p>&) in libntl.a(ZZ_pX.o)
      NTL::SkipWhiteSpace(std::istream&) in libntl.a(tools.o)
      NTL::operator>>(std::istream&, NTL::ZZ&) in libntl.a(ZZ.o)
      std::istream& NTL::operator>><NTL::ZZ>(std::istream&, NTL::Vec<NTL::ZZ>&) in libntl.a(ZZX.o)
      std::istream& NTL::operator>><NTL::zz_p>(std::istream&, NTL::Vec<NTL::zz_p>&) in libntl.a(lzz_pX.o)
  "std::istream::peek()", referenced from:
      std::istream& NTL::operator>><NTL::ZZ_p>(std::istream&, NTL::Vec<NTL::ZZ_p>&) in libntl.a(ZZ_pX.o)
      NTL::SkipWhiteSpace(std::istream&) in libntl.a(tools.o)
      NTL::operator>>(std::istream&, NTL::ZZ&) in libntl.a(ZZ.o)
      std::istream& NTL::operator>><NTL::ZZ>(std::istream&, NTL::Vec<NTL::ZZ>&) in libntl.a(ZZX.o)
      std::istream& NTL::operator>><NTL::zz_p>(std::istream&, NTL::Vec<NTL::zz_p>&) in libntl.a(lzz_pX.o)
  "std::ostream::operator<<(long)", referenced from:
      NTL::PrintTime(std::ostream&, double) in libntl.a(tools.o)
  "std::ios_base::Init::Init()", referenced from:
      __GLOBAL__I__ZN3NTL14BlockConstructEPNS_4ZZ_pEl in libntl.a(vec_ZZ_p.o)
      __GLOBAL__I__ZN3NTL5ZZ_pX4zeroEv in libntl.a(ZZ_pX.o)
      __GLOBAL__I__ZN3NTL10ZZ_pEInfoTC2ERKNS_5ZZ_pXE in libntl.a(ZZ_pE.o)
      __GLOBAL__I__ZN3NTL9ZZ_pInfoTC2ERKNS_2ZZE in libntl.a(ZZ_p.o)
      __GLOBAL__I__ntl_abort_cxx_callback in libntl.a(tools.o)
      __GLOBAL__I__ZN3NTL2ZZ4zeroEv in libntl.a(ZZ.o)
      __GLOBAL__I__ZN3NTL9FFTTablesE in libntl.a(FFT.o)
      ...
  "std::ios_base::Init::~Init()", referenced from:
      ___tcf_4 in libntl.a(vec_ZZ_p.o)
      ___tcf_16 in libntl.a(ZZ_pX.o)
      ___tcf_1 in libntl.a(ZZ_pE.o)
      ___tcf_3 in libntl.a(ZZ_p.o)
      ___tcf_0 in libntl.a(tools.o)
      ___tcf_25 in libntl.a(ZZ.o)
      ___tcf_4 in libntl.a(FFT.o)
      ...
  "std::cerr", referenced from:
      NTL::Error(char const*) in libntl.a(tools.o)
      NTL::IntValToChar(long) in libntl.a(tools.o)
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      std::ostream& NTL::operator<<<NTL::ZZ_p>(std::ostream&, NTL::Vec<NTL::ZZ_p> const&) in libntl.a(ZZ_pX.o)
      NTL::PrintTime(std::ostream&, double) in libntl.a(tools.o)
      NTL::Error(char const*) in libntl.a(tools.o)
      NTL::IntValToChar(long) in libntl.a(tools.o)
      NTL::PrintDigits(std::ostream&, long, long) in libntl.a(ZZ.o)
      NTL::operator<<(std::ostream&, NTL::ZZ const&) in libntl.a(ZZ.o)
      std::ostream& NTL::operator<<<NTL::ZZ>(std::ostream&, NTL::Vec<NTL::ZZ> const&) in libntl.a(ZZX.o)
      ...
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)", referenced from:
      std::ostream& NTL::operator<<<NTL::ZZ_p>(std::ostream&, NTL::Vec<NTL::ZZ_p> const&) in libntl.a(ZZ_pX.o)
      NTL::PrintDigits(std::ostream&, long, long) in libntl.a(ZZ.o)
      std::ostream& NTL::operator<<<NTL::ZZ>(std::ostream&, NTL::Vec<NTL::ZZ> const&) in libntl.a(ZZX.o)
      std::ostream& NTL::operator<<<NTL::zz_p>(std::ostream&, NTL::Vec<NTL::zz_p> const&) in libntl.a(lzz_pX.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
4

0 回答 0