在Eclipse上除錯C++程式報錯:x86-64 is not compatible with target architecture i386.
阿新 • • 發佈:2019-02-14
背景: 在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.
問題分析::x86-64 is not compatible with target architecture i386. 可以看出是相容性問題。我發現我的程式是使用32位編譯,卻使用了64位gdb來除錯,因此會出現此類相容性問題,其他類似的問題可以參考。
解決方案:編譯除錯要相容(compatible).以下可任選一種。
1、使用64位編譯器編譯並且使用64位偵錯程式除錯。
2、使用32位編譯器編譯並且使用32位偵錯程式除錯。
我選擇了第二種方案,即在我原來的基礎之上,修改為32位的gdb偵錯程式即可。
具體操作:在eclipse中,Debug Configurations(右擊可執行檔案,Debug as,, 即可找到), 在Debugger對應tag下。配置制定的gdb.
總結:在IDE中,編譯器和偵錯程式使用型別不確定時,可以先在命令列模式(Command)嘗試。然後再回到IDE中手動新增。