Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

__next_prime symbol undefined

Tags:

c++

std

xcode

ios

I am including unordered_map in a XCode project for iOS. Originally when I tried linking I got errors for new and delete operations, but when I added "-lstdc++" to "Other Linker Flags" those go away, but I am left with the following missing symbol.

"std::__1::__next_prime(unsigned long)", referenced from:

I tried different combinations of C++ Standard Language/Dialect but cannot get this to go away.

Any idea what library includes this?

Thanks!

like image 859
Locksleyu Avatar asked Mar 07 '13 19:03

Locksleyu


People also ask

What are undefined symbols?

Undefined Symbols After all of the input files have been read and all symbol resolution is complete, the link-editor searches the internal symbol table for any symbol references that have not been bound to symbol definitions. These symbol references are referred to as undefinedsymbols.

What does the prime symbol mean in calculus?

The prime symbol is used to denote the derivative of a function. Typically, the symbol is used in an expression like this: In plain language, this expression represents the first derivative of the function f.

What is an undefined weak reference in C++?

If a dynamic executable or shared object is being produced, the symbol is left as an undefined weak reference with an assigned value of zero. During process execution, the runtime linker searches for this symbol.

How to check if a number is prime or not in Python?

First of all, take a boolean variable found and initialise it to false.; Now, until that variable not equals to true, increment N by 1 in each iteration and check whether it is prime or not.; If it is prime then print it and change value of found variable to True. otherwise, iterate the loop untill you will get the next prime number.


1 Answers

This function is a private method in LLVM's libc++: http://www.opensource.apple.com/source/libcpp/libcpp-31/src/hash.cpp?txt. Therefore, you need to change your C++ Standard Library to libc++ (LLVM C++ standard library with C++11 support), or change your linker flag to -lc++.

like image 143
nneonneo Avatar answered Oct 10 '22 18:10

nneonneo