在Eclipse上调试C++程序报错:x86-64 is not compatible with target architecture i386.

背景:  在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.

 

参考:https://stackoverflow.com/questions/12205256/gdb-failing-in-eclipse

总结:在IDE中,编译器和调试器使用类型不确定时,可以先在命令行模式(Command)尝试。然后再回到IDE中手动添加。

 

你可能感兴趣的:(工具,aria2)