Chinaunix首页 | 论坛 | 博客
  • 博客访问: 714618
  • 博文数量: 176
  • 博客积分: 2548
  • 博客等级: 少校
  • 技术积分: 1749
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-29 16:36
个人简介

爱咋咋地

文章分类

全部博文(176)

文章存档

2024年(1)

2023年(17)

2022年(19)

2021年(3)

2020年(1)

2018年(1)

2017年(1)

2014年(1)

2013年(4)

2012年(11)

2011年(19)

2010年(22)

2009年(71)

2008年(5)

分类: C/C++

2009-06-04 09:57:45

在用g++4.1.2 编译一个文件,只加了-g参数
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
#include
#include
using namespace std;
bool test_string( string temp1 , string temp2 ){
        string a1 = temp1;
        string a2 = temp2;
        cout<< temp1 << temp2<}
int main( int argc , char ** argv ){
        test_string("test1" , "test21");
        return 0;
}
在用gdb跟进test_string函数后,用p命令显示temp1 和temp2 为乱码。
但在执行到cout<< temp1 << temp2<然后cout<< temp1 << temp2<
换g++ 3.4.6 后一切正常。
gdb版本为:
GNU gdb Fedora (6.8-27.el5)
大家引以为戒!!我废了不少时间才找到问题所在的。
阅读(534) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~