当前位置: 技术问答>linux和unix
g++编译联接都通过,运行却提示"段错误",怎么回事?
来源: 互联网 发布时间:2015-07-30
本文导语: 写了一个类string.h string.cpp 编译成功为string.o 在主函数中调用string,文件名为hello.cpp 编译成功为hello.o 然后g++ -o hello hello.o string.o也成功 但运行就提示"段错误",怎么回事? 刚刚接触linux,thanks. | ...
写了一个类string.h string.cpp
编译成功为string.o
在主函数中调用string,文件名为hello.cpp
编译成功为hello.o
然后g++ -o hello hello.o string.o也成功
但运行就提示"段错误",怎么回事?
刚刚接触linux,thanks.
编译成功为string.o
在主函数中调用string,文件名为hello.cpp
编译成功为hello.o
然后g++ -o hello hello.o string.o也成功
但运行就提示"段错误",怎么回事?
刚刚接触linux,thanks.
|
程序里有内存访问错误。
|
用gdb查一下,是错在什么地方了。
|
一般都是缓冲区溢出的原因,比如定义了char buffer[100],而存入的东西却超出了100.
检查一下.
检查一下.
|
应该是内存读写时有错,查一查你的字符串和指针吧!
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。