Note that there are some explanatory texts on larger screens.

plurals
  1. POundefined reference to `__dynamic_cast' using libc++ on ubuntu
    primarykey
    data
    text
    <p>I'm trying to compile a test case that employs <code>dynamic_cast</code> using libc++, which was compiled according to <a href="http://libcxx.llvm.org/" rel="nofollow noreferrer">"Build on Linux using CMake and libsupc++"</a>.</p> <pre><code>#include &lt;iostream&gt; struct A { virtual void f(){ std::cout &lt;&lt; "Virtual A" &lt;&lt; std::endl; } virtual ~A(){} }; struct B : public A { void f() { std::cout &lt;&lt; "Virtual B" &lt;&lt; std::endl; } virtual ~B(){} }; int main() { A *a = new B; B *b = dynamic_cast&lt;B *&gt;(a); delete a; } </code></pre> <p>I'm on ubuntu 13.04 and compiling with <code>clang++ -std=c++11 -stdlib=libc++</code>.</p> <p>Why I'm getting <code>undefined reference to '__dynamic_cast'</code>? How to solve it?</p> <h3>EDIT</h3> <p>Looks like it has something to do with libc++abi <a href="http://libcxxabi.llvm.org/spec.html" rel="nofollow noreferrer">since I'm seeing <code>__dynamic_cast</code> prototype in the spec</a>. I expected the <code>libsupc++</code> first build option to work without such issues... and trying to compile libc++abi on linux <a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-February/019907.html" rel="nofollow noreferrer">is another issue itself</a>.</p> <p>This seems related to <a href="https://stackoverflow.com/q/7016730">Compiling with Clang using Libc++ undefined references</a>.</p> <p>If this is indeed the problem, is there a straightforward process to use libc++ on linux that can compile that short snippet, or is it just not yet supported?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload