请问程序运行的问题,C:\WINDOWS\system32\msasn1.dll”,Cannot find or open the PDB file

chuand_dao 2011-12-27 09:56:04
全部代码如下:
#pragma once
#include"BinaryTree.h"
#include"MinHeap.h"
struct Code
{
char ch;//字符
int Num;//字符对应的频率;
};
template<class T>
class Huffman
{
public:
Huffman(void)
{
weight=0;
cH=new Code[256];
memset(cH,0,256);
types=0;
}
~Huffman(void){delete []cH;}
template<class T>
friend BinaryTree<char> HuffmanTree(T [],char [],int,int );
template<class T>
friend bool operator>(const Huffman<T>&x1,const Huffman<T>&x2);
template<class T>
friend bool operator<=(const Huffman<T>&x1,const Huffman<T>&x2);
template<class T>
friend bool operator<(const Huffman<T>&x1,const Huffman<T>&x2);
int Find(char ch);//查找cH中是否存在字符ch,若存在,返回其所在位置(从1开始),否则,返回0;
template<class T>
friend ostream& operator<<(ostream&out,Huffman<T>&x1);
BinaryTree<char> tree;
T weight;
int GetTypes(){return types;}
void GetKinds(char [],int n);//求输入字符的类型总数n
int* Frequence();//求各类型字符的个数,按照出现的先后顺序
void print();//输出每个字符对应的频率
char* ChTypes();//返回字符类型的数组;

private:
Code *cH;
int types;//字符的种类数
};
template<class T>
ostream& operator<<(ostream&out,Huffman<T>&x1)
{
out<<x1.weight;
return out;
}
template<class T>
int Huffman<T>::Find(char c)
{
int temp=0;
for(int i=0;i<types;i++)
{
if(cH[i].ch==c)
{
temp=i+1;
return temp;
}
}
return 0;
}
template<class T>
bool operator>(const Huffman<T>&x1,const Huffman<T>&x2)
{
return x1.weight>x2.weight;
}
template<class T>
bool operator<=(const Huffman<T>&x1,const Huffman<T>&x2)
{
return x1.weight<=x2.weight;
}
template<class T>
bool operator<(const Huffman<T>&x1,const Huffman<T>&x2)
{
return x1.weight<x2.weight;
}
template<class T>
BinaryTree<char> HuffmanTree(T a[],char c[],int a_length,int c_length)//a[]穿入各个字符的权重,c[]传入所有类型字符组成的数组,a_length, // c_length分别为a[],c[]的元素个数
{
MinHeap<Huffman<T>>temp;
Huffman<T>*w=new Huffman<T>[a_length+1];
BinaryTree<char>z,zero;
for(int i=1;i<=a_length;i++)
{
z.MakeTree(c[i-1],zero,zero);
w[i].weight=a[i-1];
w[i].tree=z;
}
MinHeap<Huffman<T>>H(1);
temp=H.Initialize(w,a_length,a_length-1);
temp.Output();//这个代码加入的目的是我之前为了监视一下最小堆的结果是否正确加的
Huffman<T> x,y;
for(int i=1;i<a_length;i++)
{
H.DeleteMin(x);
H.DeleteMin(y);
z.MakeTree(0,x.tree,y.tree);
x.weight+=y.weight ;x.tree=z;
H.Insert(x);
}
H.DeleteMin(x);
H.Deactivate();
delete []w;
return x.tree;
}
template<class T>
void Huffman<T>::GetKinds(char a[],int n)
{
for(int i=0;i<n;i++)
{
if(!Find(a[i]))
{
cH[types].ch=a[i];
cH[types].Num++;
types++;

}
else
{
cH[Find(a[i])-1].Num++;
}
}
}
template<class T>
void Huffman<T>::print()
{
for(int i=0;i<types;i++)
cout<<"字符"<<cH[i].ch<<"的频率为: "<<cH[i].Num<<endl;
}
template<class T>
int* Huffman<T>::Frequence()
{
int *Intemp=new int[types];
for(int i=0;i<types;i++)
Intemp[i]=cH[i].Num;
return Intemp;
}
template<class T>
char* Huffman<T>::ChTypes()
{
char *Chtemp=new char[types];
for(int i=0;i<types;i++)
Chtemp[i]=cH[i].ch;
return Chtemp;
}
//////////////////////////////////////
#pragma once
#include<iostream>
using namespace std;
template<class T>
class BinaryTreeNode
{
public:
BinaryTreeNode( T e,BinaryTreeNode<T>*l,BinaryTreeNode<T>*r);
~BinaryTreeNode<T>();
template<class T>
friend void pre(BinaryTreeNode<T>*);
private:
T data;
BinaryTreeNode<T>*leftchild;
BinaryTreeNode<T>*rightchild;
};
template<class T>
void pre(BinaryTreeNode<T>*t)
{
if(t)
{
cout<<t->data<<" ";
pre(t->leftchild);
pre(t->rightchild);
}
}

template<class T>
BinaryTreeNode<T>::BinaryTreeNode( T e,BinaryTreeNode<T>*l,BinaryTreeNode<T>*r)
{
data=e;
leftchild=l;
rightchild=r;
}
template<class T>
BinaryTreeNode<T>::~BinaryTreeNode()
{
}
template<class T>
class BinaryTree
{
public:
BinaryTree(void);
~BinaryTree(void);
void MakeTree( T e,BinaryTree<T>&l,BinaryTree<T>&r);
void PreOrder(BinaryTree<T>&);
private:
BinaryTreeNode<T>*root;//根节点
};
template<class T>
BinaryTree<T>::BinaryTree()
{
root=0;
}
template<class T>
BinaryTree<T>::~BinaryTree()
{
}
template<class T>
void BinaryTree<T>::PreOrder(BinaryTree<T>&x)
{
BinaryTreeNode<T>*t;
t=x.root;
pre(t);
}
template<class T>
void BinaryTree<T>::MakeTree( T e,BinaryTree<T>&l,BinaryTree<T>&r)
{
root=new BinaryTreeNode<T>(e,l.root ,r.root);
l.root=r.root=0;
}

///////////////////////////////////////////////
#pragma once
#include "OutOfBounds.h"
#include<stdlib.h>
template<class T>
class MinHeap
{
public:
MinHeap(int MinHeapSize = 10);
~MinHeap() {delete [] heap;}
int Size() const {return CurrentSize;}
T Min()
{
if (CurrentSize == 0)
throw OutOfBounds();
return heap[1];
}
MinHeap<T>& Insert( T& x);
MinHeap<T>& DeleteMin(T& x);
MinHeap<T>& Initialize(T a[], int size, int ArraySize);
void Deactivate() {heap = 0;}
void Output() const;
MinHeap<T>& GetHeap();
private:
int CurrentSize, MaxSize;
T *heap;
};
template<class T>
MinHeap<T>&MinHeap<T>::GetHeap()
{
return heap;
}
template<class T>
MinHeap<T>::MinHeap(int MinHeapSize)
{
MaxSize = MinHeapSize;
heap = new T[MaxSize+1];
CurrentSize = 0;
}

template<class T>
MinHeap<T>& MinHeap<T>::Insert( T& x)
{
if (CurrentSize == MaxSize)
{
cout<<"溢出!"<<endl;
system("pause");
}
//为x寻找应插入的位置
//i从新的叶节点开始,并沿着树上升
int i = ++CurrentSize;
while (i != 1 && x < heap[i/2])
{
heap[i] = heap[i/2]; // 将元素下移
i /= 2; // 移向父节点
}
heap[i] = x;

return *this;
}

template<class T>
MinHeap<T>& MinHeap<T>::DeleteMin(T& x)
{
if (CurrentSize == 0)
throw OutOfBounds();

x = heap[1];

T y = heap[CurrentSize--]; //最后一个元素

// 从根开始, 为y寻找合适的位置
int i = 1, // 堆的当前节点
ci = 2; // i的子节点

while (ci <= CurrentSize)
{
// 使heap[ci] 是i较小的子节点
if (ci < CurrentSize
&& heap[ci] > heap[ci+1])
ci++;

// 能把y放入heap[i]吗?
if (y <= heap[ci])
break; // 能

// 不能
heap[i] = heap[ci]; // 子节点上移
i = ci; // 下移一层
ci *= 2;
}

heap[i] = y;

return *this;
}

template<class T>
MinHeap<T>& MinHeap<T>::Initialize(T a[], int size, int ArraySize)
{ //size为数组a的元素的个数,ArraySize为数组从a[1]算起的元素个数
delete [] heap;
heap=new T[size+1];
for(int i=1;i<=size;i++)
heap[i]=a[i];
CurrentSize = size;
MaxSize = ArraySize;

// 产生一个最小堆
for (int i = CurrentSize/2; i >= 1; i--)
{
T y = heap[i]; // 子树的根

// 寻找放置y的位置
int c = 2*i; // c 的父节点是y的目标位置

while (c <= CurrentSize)
{
// 使heap[c]是较小的子节点
if (c < CurrentSize &&
heap[c] > heap[c+1]) c++;

// 能把y放入heap[c/2]吗?
if (y <= heap[c]) break; // 能
// 不能
heap[c/2] = heap[c]; // 子节点上移
c *= 2; // 下移一层
}
heap[c/2] = y;
}
return *this;
}

template<class T>
void MinHeap<T>::Output() const
{
cout << "The " << CurrentSize
<< " elements are"<< endl;
for (int i = 1; i <= CurrentSize; i++)
cout << heap[i] << " ";
cout << endl;
}

/////////////////////////////////////////////
// Huffman压缩.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include"Huffman.h"
#include<vector>
#include<string>
int _tmain(int argc, _TCHAR* argv[])
{
int count=0;
char str[29]="aaaaaaabbbbbbcccccddddeeewwq";
Huffman<int>a;
a.GetKinds(str,28);
int *f;
char *ch;
int HLength=a.GetTypes();
f=new int[HLength];
ch=new char[HLength];
f=a.Frequence();
ch=a.ChTypes();
BinaryTree<char>temp,t;
temp=HuffmanTree(f,ch,HLength,HLength);
return 0;
}

/////////////////////////运行能够输出结果,但是后台出现“咚”的一声,单步跟踪调试发现在DeleteMin(T& x)中的
最后的return *this出发出报警“咚”的一声,同时弹出黑框,不知道这个问题怎么解决,希望给出合理的解答,而不是网上说的在设置里面勾选什么windows符号之类的东西。
调试过程中调试窗口显示:
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\ntdll.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\kernel32.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\msvcp100d.dll”,已加载符号。
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\uxtheme.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\msvcrt.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\Program Files\360\360Safe\safemon\safemon.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\shell32.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\shlwapi.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\ole32.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\oleaut32.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\msvcp60.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\wininet.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\normaliz.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\urlmon.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\iertutil.dll”,Cannot find or open the PDB file
““Huffman压缩.exe”: 已加载“C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\comctl32.dll”,Cannot find or open the PDB file
“Huffman压缩.exe”: 已加载“C:\WINDOWS\system32\comctl32.dll”,Cannot find or open the PDB file
程序“[4720] Huffman压缩.exe: 本机”已退出,返回值为 0 (0x0)。
...全文
291 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

65,202

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧