声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 4633|回复: 8

[C/C++] -1.#IND00The thread 0x108 has exited with code 0 (0x0)

[复制链接]
发表于 2007-7-28 10:24 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
在VC编程中,程序没有错误能运行,但用DEBUG出现这个是什么意思?
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL'
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFCO42D.DLL'
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mfc42loc.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\Program Files\360safe\safemon\safemon.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\SogouPY.ime', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comdlg32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dllMergeDict.dll', no matching symbolic information found.
Loaded 'D:\必备软件\输入法\SogouInput\plugin\SgImeWord.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msimg32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Rising\AntiSpyware\ieprot.dll', no matching symbolic information found.
Warning: no message line prompt for ID 0x8003.
Warning: no message line prompt for ID 0x8003.
Y==================-1.#IND00======================-1.#IND00The thread 0x108 has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{497} normal block at 0x00427FA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{495} normal block at 0x004260A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{493} normal block at 0x00426120, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{491} normal block at 0x004261A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{489} normal block at 0x00426220, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{483} normal block at 0x004262A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{481} normal block at 0x00426320, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{479} normal block at 0x004263A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{477} normal block at 0x00426420, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{475} normal block at 0x004264A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{469} normal block at 0x00426520, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{467} normal block at 0x004265A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{465} normal block at 0x00426620, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{463} normal block at 0x004266A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{461} normal block at 0x00426720, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{455} normal block at 0x004267A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{453} normal block at 0x00426820, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{451} normal block at 0x004268A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{449} normal block at 0x00426920, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{447} normal block at 0x004269A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{441} normal block at 0x00426A20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{439} normal block at 0x00426AA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{437} normal block at 0x00426B20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{435} normal block at 0x00426BA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{433} normal block at 0x00426C20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{427} normal block at 0x00426CA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{425} normal block at 0x00426D20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{423} normal block at 0x00426DA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{421} normal block at 0x00426E20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{419} normal block at 0x00423D10, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{413} normal block at 0x00426EA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{411} normal block at 0x00426F20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{409} normal block at 0x00426FA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{407} normal block at 0x004250A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{405} normal block at 0x00425120, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{399} normal block at 0x004251A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{397} normal block at 0x00425220, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{395} normal block at 0x004252A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{393} normal block at 0x00425320, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{391} normal block at 0x004253A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{385} normal block at 0x00425420, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{383} normal block at 0x004254A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{381} normal block at 0x00425520, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{379} normal block at 0x004255A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{377} normal block at 0x00425620, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{371} normal block at 0x004256A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{369} normal block at 0x00425720, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{367} normal block at 0x004257A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{365} normal block at 0x00425820, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{363} normal block at 0x004258A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{361} normal block at 0x00425920, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{359} normal block at 0x004259A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{357} normal block at 0x00425A20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{355} normal block at 0x00425AA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{353} normal block at 0x00425B20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{351} normal block at 0x00425BA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{349} normal block at 0x00425C20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{347} normal block at 0x00425CA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{345} normal block at 0x00425D20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{343} normal block at 0x00425DA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{341} normal block at 0x00425E20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{339} normal block at 0x00425EA0, 80 bytes long.
Data: < Q/? ! kI|0    k> BC 51 2F 3F A4 21 E3 6B 49 7C 30 CB 9D D0 E9 6B
{337} normal block at 0x00425F20, 80 bytes long.
Data: <   pa Gi \ V KCi> 0C D8 E1 70 61 1D 47 69 98 5C C2 56 0C 4B 43 69
{335} normal block at 0x00425FA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{333} normal block at 0x004240A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{331} normal block at 0x00424120, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{329} normal block at 0x004241A0, 80 bytes long.
Data: < `     R  ~    R> E1 60 10 F4 CB E0 1B 52 08 E1 7E 1F BF 80 03 52
{327} normal block at 0x00424220, 80 bytes long.
Data: <W 5    P        > 57 15 35 EB FF A1 CB 50 00 00 00 00 00 00 00 00
{325} normal block at 0x004242A0, 80 bytes long.
Data: <               K> 00 00 00 00 00 00 00 00 ED DF D9 FF 87 B9 1B 4B
{323} normal block at 0x00424320, 80 bytes long.
Data: <&"    eJ   OB~tJ> 26 22 F0 A1 16 1A 65 4A CC 8E 8B 4F 42 7E 74 4A
{321} normal block at 0x004243A0, 80 bytes long.
Data: <&"    eJ   OB~tJ> 26 22 F0 A1 16 1A 65 4A CC 8E 8B 4F 42 7E 74 4A
{319} normal block at 0x00424420, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{317} normal block at 0x004244A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{315} normal block at 0x00424520, 80 bytes long.
Data: <{E r p C  P J  C> 7B 45 01 72 8D 70 8A 43 BB 84 50 F5 4A CE 8B 43
{313} normal block at 0x004245A0, 80 bytes long.
Data: <&q   [email=Z@C]Z@C[/email]    Xl4C> 26 71 DC F5 1D 5A 40 43 88 E8 A6 C5 58 6C 34 43
{311} normal block at 0x00424620, 80 bytes long.
Data: <&q   [email=Z@C]Z@C[/email]    Xl4C> 26 71 DC F5 1D 5A 40 43 88 E8 A6 C5 58 6C 34 43
{309} normal block at 0x004246A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{307} normal block at 0x00424720, 80 bytes long.
Data: <        dI  7  A> 00 00 00 00 00 00 00 00 64 49 F8 CF 37 C7 11 41
{305} normal block at 0x004247A0, 80 bytes long.
Data: <K_     @        > 4B 5F BD BD 09 D6 11 40 00 00 00 00 00 00 00 00
{303} normal block at 0x00424820, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{301} normal block at 0x004248A0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{299} normal block at 0x00424920, 80 bytes long.
Data: <       ?`yX   C?> F2 9B 15 AA 07 11 1F 3F 60 79 58 BE 14 19 43 3F
{297} normal block at 0x004249A0, 80 bytes long.
Data: <  H  A$? [  jI+?> DA E9 48 1E 85 41 24 3F FC 5B 17 02 6A 49 2B 3F
{295} normal block at 0x00424A20, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{293} normal block at 0x00424AA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{291} normal block at 0x00424B20, 80 bytes long.
Data: <        $+:    `> 00 00 00 00 00 00 00 00 24 2B 3A 9C 12 B1 E4 60
{289} normal block at 0x00424BA0, 80 bytes long.
Data: <{  S   W        > 7B 0B A0 53 97 F7 17 57 00 00 00 00 00 00 00 00
{287} normal block at 0x00424C20, 80 bytes long.
Data: <p tb   U       U> 70 AE 74 62 9F BC 08 55 EA 85 CD DA D0 BA 0A 55
{285} normal block at 0x00424CA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{283} normal block at 0x00424D20, 80 bytes long.
Data: < B   " M        > 08 42 E9 EF AD 22 12 4D 00 00 00 00 00 00 00 00
{281} normal block at 0x00424DA0, 80 bytes long.
Data: < B   " M        > 08 42 E9 EF AD 22 12 4D 00 00 00 00 00 00 00 00
{279} normal block at 0x00424E20, 80 bytes long.
Data: <        l   uf H> 00 00 00 00 00 00 00 00 6C 9A 04 94 75 66 82 48
{277} normal block at 0x00424EA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{275} normal block at 0x00424F20, 80 bytes long.
Data: < ycCfp Dq T A  D> 8B 79 63 43 66 70 DA 44 71 D8 54 ED 41 D5 E1 44
{273} normal block at 0x00424FA0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{271} normal block at 0x00423070, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{269} normal block at 0x004230F0, 80 bytes long.
Data: <    fK\B  ,   CB> BC FD B2 9E 66 4B 5C 42 8B AD 2C ED 93 E7 43 42
{267} normal block at 0x00423170, 80 bytes long.
Data: < f6 B{ A l?o   A> C9 66 36 D5 42 7B D8 41 C3 6C 3F 6F CA A5 E7 41
{265} normal block at 0x004231F0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{263} normal block at 0x00423270, 80 bytes long.
Data: <     [email=3^@j]3^@j[/email] 4   R@> F0 E4 91 91 E7 33 5E 40 6A A4 34 FF 8D 93 52 40
{261} normal block at 0x004232F0, 80 bytes long.
Data: <     [email=3^@j]3^@j[/email] 4   R@> F0 E4 91 91 E7 33 5E 40 6A A4 34 FF 8D 93 52 40
{259} normal block at 0x00423370, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{257} normal block at 0x004233F0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{255} normal block at 0x00423470, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{253} normal block at 0x004234F0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{251} normal block at 0x00423570, 80 bytes long.
Data: <        + F   8E> 00 00 00 00 00 00 00 00 2B 97 46 D6 D0 F7 38 45
{249} normal block at 0x004235F0, 80 bytes long.
Data: <  J2   C        > B6 D5 4A 32 DD A9 03 43 00 00 00 00 00 00 00 00
{247} normal block at 0x00423670, 80 bytes long.
Data: < 2    uB        > D5 32 AE F1 D9 94 75 42 00 00 00 00 00 00 00 00
{245} normal block at 0x004236F0, 80 bytes long.
Data: <               @> 00 00 00 00 00 00 00 00 FE 9C A6 D4 E7 0A C0 40
{243} normal block at 0x00423770, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{241} normal block at 0x004237F0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{239} normal block at 0x00423870, 80 bytes long.
Data: <    v  ?  6  \ ?> B2 EA 7F 01 76 91 B2 3F BA A7 36 D4 B3 5C 9A 3F
{237} normal block at 0x004238F0, 80 bytes long.
Data: <7g?  8l?  P   a?> 37 67 3F 08 CD 38 6C 3F A9 DB 50 84 BD 1B 61 3F
{235} normal block at 0x00423970, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{233} normal block at 0x004239F0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{231} normal block at 0x00423A70, 80 bytes long.
Data: <        ]8R  # @> 00 00 00 00 00 00 00 00 5D 38 52 F0 06 23 E8 40
{229} normal block at 0x00423AF0, 80 bytes long.
Data: < ,FH Z ?        > F6 2C 46 48 1F 5A C9 3F 00 00 00 00 00 00 00 00
{227} normal block at 0x00423B70, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{225} normal block at 0x00423BF0, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{223} normal block at 0x00423C70, 80 bytes long.
Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
The thread 0xF4 has exited with code 0 (0x0).
The program 'D:\VC6.0\MSDev98\MyProjects\TWOROTSYS\Debug\TWOROTSYS.exe' has exited with code 0 (0x0).

中间这一行我是看一下矩阵Y的值,可出来这不知道什么意思
Y==================-1.#IND00======================-1.#IND00The thread 0x108 has exited with code 0 (0x0).
请教大牛
回复
分享到:

使用道具 举报

发表于 2007-7-29 15:15 | 显示全部楼层
需要安装debug symbols
插入安装光盘在“开始”-“程序”-“Microsoft Visual Studio 6.0”-“Microsoft Visual Studio”-“Windows NT Symbols Setup”
发表于 2007-7-29 15:17 | 显示全部楼层
估计你这个程序是Release版的
 楼主| 发表于 2007-8-6 11:35 | 显示全部楼层
debug symbols   有什么用啊  这两个版本有什么区别
发表于 2007-9-3 09:57 | 显示全部楼层
Debug通常称为调试版本,它包含调试信息,并且不作任何优化,便于程序员调试程序。Release称为发布版本,它往往是进行了各种优化,使得程序在代码大小和运行速度上都是最优的,以便用户很好地使用。
Debug 和 Release 的真正秘密,在于一组编译选项。下面列出了分别针对二者的选项(当然除此之外还有其他一些,如/Fd /Fo,但区别并不重要,通常他们也不会引起 Release 版错误,在此不讨论)
Debug 版本

参数 含义
/MDd /MLd 或 /MTd 使用 Debug runtime library (调试版本的运行时刻函数库)
/Od 关闭优化开关
/D "_DEBUG" 相当于 #define _DEBUG,打开编译调试代码开关 (主要针对assert函数)
/ZI 创建 Edit and continue(编辑继续)数据库,这样在调试过程中如果修改了源代码不需重新编译
/GZ 可以帮助捕获内存错误
/Gm 打开最小化重链接开关, 减少链接时间

Release 版本

参数 含义
/MD /ML 或 /MT 使用发布版本的运行时刻函数库
/O1 或 /O2 优化开关,使程序最小或最快
/D "NDEBUG" 关闭条件编译调试代码开关 (即不编译assert函数)
/GF 合并重复的字符串, 并将字符串常量放到只读内存, 防止被修改

实际上,Debug 和 Release 并没有本质的界限,他们只是一组编译选项的集合,编译器只是按照预定的选项行动。事实上,我们甚至可以修改这些选项,从而得到优化过的调试版本或是带跟踪语句的发布版本。
哪些情况下 Release 版会出错
有了上面的介绍,我们再来逐个对照这些选项看看 Release 版错误是怎样产生的
1、Runtime Library:链接哪种运行时刻函数库通常只对程序的性能产生影响。调试版本的 Runtime Library包含了调试信息,并采用了一些保护机制以帮助发现错误,因此性能不如发布版本。编译器提供的 Runtime Library 通常很稳定,不会造成Release 版错误;倒是由于 Debug 的 Runtime Library 加强了对错误的检测,如堆内存分配,有时会出现 Debug有错但 Release 正常的现象。应当指出的是,如果 Debug 有错,即使 Release 正常,程序肯定是有 Bug 的,只不过可能是Release 版的某次运行没有表现出来而已。
2、优化:这是造成错误的主要原因,因为关闭优化时源程序基本上是直接翻译的,而打开优化后编译器会作出一系列假设。这类错误主要有以下几种:
1. 帧指针(FramePointer)省略(简称FPO):在函数调用过程中,所有调用信息(返回地址、参数)以及自动变量都是放在栈中的。若函数的声明与实现不同(参数、返回值、调用方式),就会产生错误,但 Debug 方式下,栈的访问通过 EBP寄存器保存的地址实现,如果没有发生数组越界之类的错误(或是越界“不多”),函数通常能正常执行;Release 方式下,优化会省略 EBP栈基址指针,这样通过一个全局指针访问栈就会造成返回地址错误是程序崩溃。
C++ 的强类型特性能检查出大多数这样的错误,但如果用了强制类型转换,就不行了。你可以在 Release 版本中强制加入/Oy-编译选项来关掉帧指针省略,以确定是否此类错误。此类错误通常有:MFC 消息响应函数书写错误。正确的应为:

afx_msg LRESULT OnMessageOwn
(WPARAM wparam, LPARAM lparam);

ON_MESSAGE 宏包含强制类型转换。防止这种错误的方法之一是重定义 ON_MESSAGE 宏,把下列代码加到 stdafx.h 中(在#include "afxwin.h"之后),函数原形错误时编译会报错。

#undef ON_MESSAGE
#define ON_MESSAGE(message, memberFxn)
{
message, 0, 0, 0, AfxSig_lwl,
(AFX_PMSG)(AFX_PMSGW)
(static_cast< LRESULT (AFX_MSG_CALL
CWnd::*)(WPARAM, LPARAM) > (&memberFxn)
},

2. volatile 型变量:volatile告诉编译器该变量可能被程序之外的未知方式修改(如系统、其他进程和线程)。优化程序为了使程序性能提高,常把一些变量放在寄存器中(类似于register 关键字),而其他进程只能对该变量所在的内存进行修改,而寄存器中的值没变。
如果你的程序是多线程的,或者你发现某个变量的值与预期的不符而你确信已正确的设置了,则很可能遇到这样的问题。这种错误有时会表现为程序在最快优化出错而最小优化正常。把你认为可疑的变量加上 volatile 试试。
3. 变量优化:优化程序会根据变量的使用情况优化变量。例如,函数中有一个未被使用的变量,在 Debug版中它有可能掩盖一个数组越界,而在 Release版中,这个变量很可能被优化调,此时数组越界会破坏栈中有用的数据。当然,实际的情况会比这复杂得多。与此有关的错误有非法访问,包括数组越界、指针错误等。例如:

void fn(void)
{
  int i;
  i = 1;
  int a[4];
  {
    int j;
    j = 1;
  }
  a[-1] = 1;
  //当然错误不会这么明显,例如下标是变量
  a[4] = 1;
}


j 虽然在数组越界时已出了作用域,但其空间并未收回,因而 i 和 j 就会掩盖越界。而 Release 版由于 i、j 并未其很大作用可能会被优化掉,从而使栈被破坏。
3. DEBUG 与 NDEBUG :当定义了 _DEBUG 时,assert() 函数会被编译,而 NDEBUG 时不被编译。此外,TRACE() 宏的编译也受 _DEBUG 控制。
所有这些断言都只在 Debug版中才被编译,而在 Release 版中被忽略。唯一的例外是VERIFY()。事实上,这些宏都是调用了assert()函数,只不过附加了一些与库有关的调试代码。如果你在这些宏中加入了任何程序代码,而不只是布尔表达式(例如赋值、能改变变量值的函数调用等),那么Release版都不会执行这些操作,从而造成错误。初学者很容易犯这类错误,查找的方法也很简单,因为这些宏都已在上面列出,只要利用 VC++ 的 Find in Files功能在工程所有文件中找到用这些宏的地方再一一检查即可。另外,有些高手可能还会加入 #ifdef _DEBUG 之类的条件编译,也要注意一下。
顺便值得一提的是VERIFY()宏,这个宏允许你将程序代码放在布尔表达式里。这个宏通常用来检查 WindowsAPI的返回值。有些人可能为这个原因而滥用VERIFY(),事实上这是危险的,因为VERIFY()违反了断言的思想,不能使程序代码和调试代码完全分离,最终可能会带来很多麻烦。因此,专家们建议尽量少用这个宏。
4. /GZ 选项:这个选项会做以下这些事:
1. 初始化内存和变量。包括用 0xCC 初始化所有自动变量,0xCD ( Cleared Data )初始化堆中分配的内存(即动态分配的内存,例如 new ),0xDD ( Dead Data ) 填充已被释放的堆内存(例如 delete),0xFD( deFencde Data ) 初始化受保护的内存(debug版在动态分配内存的前后加入保护内存以防止越界访问),其中括号中的词是微软建议的助记词。这样做的好处是这些值都很大,作为指针是不可能的(而且32 位系统中指针很少是奇数值,在有些系统中奇数的指针会产生运行时错误),作为数值也很少遇到,而且这些值也很容易辨认,因此这很有利于在Debug 版中发现 Release版才会遇到的错误。要特别注意的是,很多人认为编译器会用0来初始化变量,这是错误的(而且这样很不利于查找错误)。
2. 通过函数指针调用函数时,会通过检查栈指针验证函数调用的匹配性。(防止原形不匹配)
3. 函数返回前检查栈指针,确认未被修改。(防止越界访问和原形不匹配,与第二项合在一起可大致模拟帧指针省略 FPO )通常 /GZ选项会造成 Debug 版出错而 Release 版正常的现象,因为 Release版中未初始化的变量是随机的,这有可能使指针指向一个有效地址而掩盖了非法访问。除此之外,/Gm/GF等选项造成错误的情况比较少,而且他们的效果显而易见,比较容易发现。
怎样“调试” Release 版的程序
遇到Debug成功但Release失败,显然是一件很沮丧的事,而且往往无从下手。如果你看了以上的分析,结合错误的具体表现,很快找出了错误,固然很好。但如果一时找不出,以下给出了一些在这种情况下的策略。
1.前面已经提过,Debug和Release只是一组编译选项的差别,实际上并没有什么定义能区分二者。我们可以修改Release版的编译选项来缩小错误范围。如上所述,可以把Release的选项逐个改为与之相对的Debug选项,如/MD改为/MDd、/O1改为/Od,或运行时间优化改为程序大小优化。注意,一次只改一个选项,看改哪个选项时错误消失,再对应该选项相关的错误,针对性地查找。这些选项在ProjectSettings...中都可以直接通过列表选取,通常不要手动修改。由于以上的分析已相当全面,这个方法是最有效的。
2. 在编程过程中就要时常注意测试 Release 版本,以免最后代码太多,时间又很紧。
3. 在 Debug 版中使用 /W4 警告级别,这样可以从编译器获得最大限度的错误信息,比如 if( i =0 )就会引起 /W4警告。不要忽略这些警告,通常这是你程序中的 Bug 引起的。但有时 /W4 会带来很多冗余信息,如未使用的函数参数警告,而很多消息处理函数都会忽略某些参数。我们可以用:

#progma warning(disable: 4702)
//禁止
//...
#progma warning(default: 4702)
//重新允许来暂时禁止某个警告,或使用
#progma warning(push, 3)
//设置警告级别为 /W3
//...
#progma warning(pop)
//重设为 /W4


来暂时改变警告级别,有时你可以只在认为可疑的那一部分代码使用 /W4。
4. 你也可以像Debug一样调试你的Release版,只要加入调试符号。在Project/Settings... 中,选中Settings for "Win32 Release",选中 C/C++ 标签,Category 选 General,Debug Info选 Program Database。再在 Link 标签 Project options 最后加上 "/OPT:REF"(引号不要输)。这样调试器就能使用 pdb 文件中的调试符号。
但调试时你会发现断点很难设置,变量也很难找到??这些都被优化过了。不过令人庆幸的是,Call Stack窗口仍然工作正常,即使帧指针被优化,栈信息(特别是返回地址)仍然能找到。这对定位错误很有帮助。

以上转自:http://blog.hc360.com/portal/personShowArticle.do?articleId=68069
发表于 2007-9-3 09:58 | 显示全部楼层
简单来说Debug  Symbols就是用于记录一些重要的调试信息的
发表于 2007-11-16 15:29 | 显示全部楼层
恩~~~~又长知识乐
发表于 2012-4-21 16:25 | 显示全部楼层
油瓶在手 低头猛走 鼠标一抖 一分到手

点评

灌水??  发表于 2012-5-31 01:03
发表于 2012-5-30 08:33 | 显示全部楼层
我的目标就是把所有是楼上最后一个回复的都回复了- -.

点评

灌水??  发表于 2012-5-31 01:04
灌水??  发表于 2012-5-31 01:03
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-28 12:53 , Processed in 0.164056 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表