0
我有一个简短的程序example.cc如下:C++抛出异常,段错误
#include <stdio.h>
int main()
{
try {
throw 999;
} catch (int i) {
printf("Catch i:%d", i);
}
}
如果我单独编译这个程序,它工作正常, 然而,当我与其他目标文件链接,它失败,报告分段错误,我不明白为什么..
那么,其他的目标文件是什么? – GManNickG 2011-03-29 03:43:26
@GMan:'static int * f(){return 0; } static int globalx = * f();',当然:) – 2011-03-29 03:47:02
除非我们知道链接到的其他目标文件中发生了什么,否则很难总结出任何结论。请发布源代码或jist目标文件中发生的事情,我们可以帮助您。 – 2011-03-29 04:24:49