CXX0017: 错误: 没有找到符号

来源:互联网 发布:java 免费开源oa系统 编辑:程序博客网 时间:2024/06/05 18:26
编程环境:Visual Studio 2010

首先确定是在 Debug 配置状态。

初始解决方案如下:

错误现象:CXX0017: Error: symbol this not found
方法 1:
将编译优化选项设置为"/Od"就可以了。工程右键 -> Properties -> Configuration Properites -> C/C++ -> Optimization -> Optimization: Disabled(/Od)
注:如果解决,程序可能存在逻辑错误
方法 2:
将VS生成的工程文件全部删除,(Debug目录下的pdb文件),然后全部重新生成
3. 如果未解决,可能是 Visual Studio 2010 自身bug问题。见 MSDN bug report
https://connect.microsoft.com/VisualStudio/feedback/details/613569/cannot-inspect-local-variables-while-debugging-in-vs2010-cxx0017-symbol-not-found-error#details
情况 1.  
[cpp] view plaincopy
  1. int _tmain(int argc, _TCHAR* argv[])  
  2. {  
  3.     float f = 123.0;   //声明并初始化   
  4.   
  5.     if(false)  
  6.     {  
  7.         int str1;   //if中声明新变量。关键!去掉此处可以解决问题,所以可在 if 外声明  
  8.     }  
  9.     else  
  10.     {  
  11.         //else中声明的变量在调试时,出问题  
  12.         int str2;  
  13.         int a = 123;   
  14.         a++;  
  15.     }  
  16.     return 0;  
  17. }  
情况 2. 解决方案 将 k 作为局部变量使用,即for(int k=0;k<2;k++)
[cpp] view plaincopy
  1. #include <stdio.h>  
  2.   
  3. int main()  
  4. {  
  5.     int arr[5];  
  6.     int k;    //循环变量,非局部  
  7.     float f=123;  
  8.   
  9.     for(k=0;k<2;k++)  
  10.     {  
  11.         arr[k] = 2;  
  12.   
  13.         int t = 5;  
  14.         printf("%d\n",t);  
  15.     }  
  16.   
  17.     int i = 2;  
  18.   
  19.     if(i > 0)    //if从句内出现的 新变量,也会出现问题  
  20.     {  
  21.         int joke;  
  22.         printf("waht\n");  
  23.     }  
  24.   
  25.     return 0;  
  26. }  
以上只是已测试的情况,如果类似问题,可参考进行调试
0 0