由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 问个C++ Segmentation Fault的问题
相关主题
走遍了南北西东,最Clean/Elegant还是C++[转载] 问个腐烂的问题----cleaning lady
[转载] 简单的题都不敢做了.急问个furnace有关的问题:要不要换inducer motor?
Help!! variable scope ????再问个关于Air Duct Cleaning的问题。
Linus Torvalds因内核注解标点格式发飙 solidot teikaei 21小时54分钟前 Linus Torvalds在Linux内核邮件开发者列表上再次发飙,将部分程序员偏爱的代码注解标点格式称为“脑残”。他强烈反对的注解格式类似:/* This is disgusting drug-induced * crap, and should die */(具体见下图) http://static.cnbetacdn.com/article/2016/0713/00a2039be872问个洗牙的事
可不可以这样认为能问个洗牙问题吗
CNN regular: GOP train crash shows God 'cleaning up the st问个洗牙的事
新手问个最弱的问题:salvage title 和clean title分别是怎么定义的?
相关话题的讨论汇总
话题: fault话题: c++话题: build话题: 问个
进入Programming版参与讨论
1 (共1页)
C******e
发帖数: 6
1
今天遇到一个神奇的错误
有一个别人写好的类,我试图在里面加两个short int类型的public成员变量
结果是这样的,如果我把这两个成员变量加在public:和构造函数中间,就会产生
segmentation fault;如果放在所有成员变量和成员函数的最后,就没有错误
有人知道这是为什么吗?
c*****t
发帖数: 1879
2
You need to recompile all classes after you make changes to
the header files.

【在 C******e 的大作中提到】
: 今天遇到一个神奇的错误
: 有一个别人写好的类,我试图在里面加两个short int类型的public成员变量
: 结果是这样的,如果我把这两个成员变量加在public:和构造函数中间,就会产生
: segmentation fault;如果放在所有成员变量和成员函数的最后,就没有错误
: 有人知道这是为什么吗?

p*u
发帖数: 2454
3
you must have weird compiler/system. Try to make clean first,
then build from top.

【在 C******e 的大作中提到】
: 今天遇到一个神奇的错误
: 有一个别人写好的类,我试图在里面加两个short int类型的public成员变量
: 结果是这样的,如果我把这两个成员变量加在public:和构造函数中间,就会产生
: segmentation fault;如果放在所有成员变量和成员函数的最后,就没有错误
: 有人知道这是为什么吗?

d*****a
发帖数: 110
4
clean build.
p***o
发帖数: 1252
5
有可能他用的是头文件+库文件而没有源代码。

【在 p*u 的大作中提到】
: you must have weird compiler/system. Try to make clean first,
: then build from top.

d*****a
发帖数: 110
6
hehe, sorry, I'm not LZ. that was just what I would do to solve the problem.

【在 p*u 的大作中提到】
: you must have weird compiler/system. Try to make clean first,
: then build from top.

A*********l
发帖数: 2005
7
As some people suggested, first try clean full build. Every binary using
that class needs to be rebuilt.
If it still has segmentation fault, hook up a debugger to the process and
let it run. When it crashes, you will see the call stack in the debugger,
that's the best way to solve such problems. There are so many possible
causes here.
One possibity is: Say this class is A, and a A* is cast to B*, because
originally A and B has the same memory layout up to certain point. And the
code is trying to

【在 C******e 的大作中提到】
: 今天遇到一个神奇的错误
: 有一个别人写好的类,我试图在里面加两个short int类型的public成员变量
: 结果是这样的,如果我把这两个成员变量加在public:和构造函数中间,就会产生
: segmentation fault;如果放在所有成员变量和成员函数的最后,就没有错误
: 有人知道这是为什么吗?

C******e
发帖数: 6
8
Thanks for all replies
I cleaned the build and it works now:)

【在 C******e 的大作中提到】
: 今天遇到一个神奇的错误
: 有一个别人写好的类,我试图在里面加两个short int类型的public成员变量
: 结果是这样的,如果我把这两个成员变量加在public:和构造函数中间,就会产生
: segmentation fault;如果放在所有成员变量和成员函数的最后,就没有错误
: 有人知道这是为什么吗?

1 (共1页)
进入Programming版参与讨论
相关主题
[转载] 简单的题都不敢做了.急问个furnace有关的问题:要不要换inducer motor?
Help!! variable scope ????再问个关于Air Duct Cleaning的问题。
Linus Torvalds因内核注解标点格式发飙 solidot teikaei 21小时54分钟前 Linus Torvalds在Linux内核邮件开发者列表上再次发飙,将部分程序员偏爱的代码注解标点格式称为“脑残”。他强烈反对的注解格式类似:/* This is disgusting drug-induced * crap, and should die */(具体见下图) http://static.cnbetacdn.com/article/2016/0713/00a2039be872问个洗牙的事
可不可以这样认为能问个洗牙问题吗
CNN regular: GOP train crash shows God 'cleaning up the st问个洗牙的事
新手问个最弱的问题:salvage title 和clean title分别是怎么定义的?走遍了南北西东,最Clean/Elegant还是C++
[转载] 问个腐烂的问题----cleaning lady
相关话题的讨论汇总
话题: fault话题: c++话题: build话题: 问个