Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
linux上的std::cerr与clang++;和libc++;导致西格布特_Linux_Clang++_Libc++ - Fatal编程技术网

linux上的std::cerr与clang++;和libc++;导致西格布特

linux上的std::cerr与clang++;和libc++;导致西格布特,linux,clang++,libc++,Linux,Clang++,Libc++,我正在尝试在Ubuntu 12.04 x64上运行一个简单的程序,该程序使用clang++3.3 libc++libc++abi编译 节目: #include <iostream> int main(int argc, char **argv) { try { std::cerr << "Test cerr \n"; } catch (...) { std::cout << "catch exception"; } return

我正在尝试在Ubuntu 12.04 x64上运行一个简单的程序,该程序使用clang++3.3 libc++libc++abi编译

节目:

#include <iostream>
int main(int argc, char **argv) {
  try {
    std::cerr << "Test cerr \n";
  } catch (...) {
    std::cout << "catch exception";
  }
  return 0;
}
谁能给我一个提示如何解决这个问题

以下是回溯:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Test cerr

Program received signal SIGABRT, Aborted.
0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) backtrace
#0  0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7051b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff792a437 in std::uncaught_exception() () from /usr/local/lib/libc++.so.1
#3  0x00007ffff79324e2 in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() ()
   from /usr/local/lib/libc++.so.1
#4  0x000000000040118e in std::__1::operator<< <std::__1::char_traits<char> > (__os=..., __str=0x401784 "Test cerr \n")
    at /usr/local/include/c++/v1/ostream:990
#5  0x0000000000400d41 in main (argc=1, argv=0x7fffffffe728) at cerr_test.cpp:5
(gdb)
[启用使用libthread\u db的线程调试]
使用主机libthread_db library“/lib/x86_64-linux-gnu/libthread_db.so.1”。
测试中心
程序收到信号SIGABRT,中止。
来自/lib/x86_64-linux-gnu/libc.so.6的提升()中的0x00007ffff704e425
(gdb)回溯
#0 0x00007FF704E425在/lib/x86_64-linux-gnu/libc.so.6的raise()中
#1 0x00007FF7051B8B位于/lib/x86_64-linux-gnu/libc.so.6的abort()中
#来自/usr/local/lib/libc++.so.1的std::uncaught_exception()中的2 0x00007ff792a437
#标准中的3 0x00007FF79324E2::uu 1::basic_ostream::sentry::~sentry()
来自/usr/local/lib/libc++.so.1

#std::uu 1::operator中的4 0x000000000040118e它最终通过使用libcxrt而不是@chico

建议的libc++abi工作。您可以使用调试和崩溃后堆栈跟踪进行编译吗?当然可以。刚刚在我的Linux系统(32位GCC4.7和Clang3.2)上添加了回溯功能,工作正常。您正在使用哪些编译选项?也可以不使用。用try-catch块封闭std::cerr调用会导致相同的回溯。。。它仍然说std::uncaught_exception。
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Test cerr

Program received signal SIGABRT, Aborted.
0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) backtrace
#0  0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7051b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff792a437 in std::uncaught_exception() () from /usr/local/lib/libc++.so.1
#3  0x00007ffff79324e2 in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() ()
   from /usr/local/lib/libc++.so.1
#4  0x000000000040118e in std::__1::operator<< <std::__1::char_traits<char> > (__os=..., __str=0x401784 "Test cerr \n")
    at /usr/local/include/c++/v1/ostream:990
#5  0x0000000000400d41 in main (argc=1, argv=0x7fffffffe728) at cerr_test.cpp:5
(gdb)