EclipseでC++プログラムをデバッグエラー:x 86-64 is not compatible with target architecture i 386.

2167 ワード

背景:WindowsでEclipseを使用してC++プログラムをデバッグします.
プログラムエラーは次のとおりです.
warning: `/cygdrive/c/Windows/SYSTEM32/ntdll.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `/cygdrive/c/Windows/System32/wow64.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `/cygdrive/c/Windows/System32/wow64win.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: dll path for "WOW64_IMAGE_SECTION" can not be evaluated
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
Do you need "set solib-search-path" or "set sysroot"?
warning: dll path for "WOW64_IMAGE_SECTION" can not be evaluated
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
Do you need "set solib-search-path" or "set sysroot"?
warning: dll path for "NOT_AN_IMAGE" can not be evaluated
warning: Could not load shared library symbols for NOT_AN_IMAGE.
Do you need "set solib-search-path" or "set sysroot"?
warning: dll path for "NOT_AN_IMAGE" can not be evaluated
warning: Could not load shared library symbols for NOT_AN_IMAGE.
Do you need "set solib-search-path" or "set sysroot"?
warning: `/cygdrive/c/Windows/System32/wow64cpu.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.

問題分析:x 86-64 is not compatible with target architecture i 386.互換性の問題であることがわかります.私のプログラムは32ビットコンパイルを使用しているのに、64ビットgdbを使用してデバッグしているため、このような互換性の問題が発生し、他の類似の問題が参考になります.
 
ソリューション:コンパイルデバッグは互換性がある.以下のいずれかを選択することができる.
1.64ビットコンパイラを使用してコンパイルし、64ビットデバッガを使用してデバッグします.
2、32ビットコンパイラを使用してコンパイルし、32ビットデバッガを使用してデバッグします.
私は2つ目の案を選びました.つまり、私の元の基礎の上で、32ビットのgdbデバッガに変更すればいいです.
具体的な操作:eclipseでは、Debug Configurations(実行可能ファイル、Debug asを右クリックすると、見つかります)がDebugger対応tagの下にあります.作成したgdbを構成する.
 
参照先:https://stackoverflow.com/questions/12205256/gdb-failing-in-eclipse
まとめ:IDEでコンパイラとデバッガの使用タイプが不確定な場合は、コマンドラインモード(Command)で試してから、IDEに戻って手動で追加できます.