最近在使用vs过程中,出现了无法查找或打开PDB文件的问题。
代码如下:
1 #include<stdio.h> 2 #include<conio.h> 3 #include<string.h> 4 #define N 10 5 #define LEN 26 6 void BubbleSort(char[][LEN + 1]); 7 int main() 8 { 9 int i = 0; 10 char words[N][LEN + 1]; 11 12 printf("请输入需要排序的数据\n(输入 '9' 表示输入结束)(不超过%d个单词,每个单词不超过%d个字母):\n", N, LEN); 13 while (1) 14 { 15 scanf_s("%s", words[i], 26); 16 i++; 17 if (words[i - 1][0] == 57) 18 { 19 break; 20 } 21 22 } 23 BubbleSort(words);//调用排序函数 24 printf("按照升序排序后的结果为:\n"); 25 for (i = 0; i < N; i++)//输出字符串 26 printf("%s\n", words[i]); 27 _getche(); 28 } 29 void BubbleSort(char w[N][LEN + 1]) 30 { 31 int i = 0, j = 0, n = 0; 32 char tmp[LEN + 1];//用于字符串复制的中间变量 33 for (j = 0; j < N - 1; j++) 34 { 35 for (i = 0; i < N - 1 - j; i++) 36 { 37 if (strcmp(w[i], w[i + 1]) > 0)//字符串比较 38 { 39 strcpy_s(tmp, strlen(w[i]), w[i]);//字符串复制 40 strcpy_s(w[i], strlen(w[i + 1]), w[i + 1]); 41 strcpy_s(w[i + 1], strlen(tmp), tmp); 42 } 43 } 44 } 45 }
解决方法为:
http://c.biancheng.net/view/474.html
1) 选择菜单栏中的“调试 --> 选项”。
2) 弹出“选项”对话框后,选择“调试 --> 常规”,在右侧选项栏中勾选“启用源服务器支持”(包含的 3 个子选项不用勾选),此时会弹出一个安全警报框,选择“是”即可。
3) 还是在“选项”对话框中,选择“调试 --> 符号”,在右侧选项栏中勾选“Microsoft符号服务器”,此时会弹出一个提示对话框,点击“确定”即可。同时,对于缓存符号的目录,选择图示中的目录即可。
4) 确定之后,重新运行你的程序,首次运行时,由于编译器会加载所有动态链接库的pdb文件,可能会等到几秒钟。程序运行后,之前输出窗口中的“无法查找或打开pdb文件”的提示不见了。