shengli 发表于 2009-12-11 16:37:52

请教:弹出错误 L6242E: Cannot link object __main.o as its attributes are incompa

用mdk3.05编译简单的程序,弹出错误L6242E: Cannot link object __main.o as its attributes are incompatible with the image attributes.

int main(void)
{
return 1;
}


Build target 'Target 1'
compiling t2.c...
linking...
t2.axf: Error: L6242E: Cannot link object __main.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object kernel.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object exit.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object lib_init.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object stkheap1.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object sys_exit.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object libspace.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object sys_stackheap.o as its attributes are incompatible with the image attributes.
t2.axf: Error: L6242E: Cannot link object use_semi.o as its attributes are incompatible with the image attributes.
Target not created

哪里设置不对?

dzqqqq 发表于 2009-12-11 22:42:51

设置一下代码段的位置啊

helloshi 发表于 2009-12-11 22:47:03

void main(void)
{
}

???

dzqqqq 发表于 2009-12-12 00:18:39

说不清楚,你发个工程上来看看

zpwang 发表于 2009-12-16 20:41:35

会不会是启动文件有问题?

yyzhen 发表于 2012-1-6 13:56:35

使用的是别人的静态库吧?使用别人提供的 .a库链接时候出现L6242E错误。

L6242E: Cannot link object <objname> as its attributes are incompatible with the image attributes

There are three common reasons for this error message:

1) Error: L6242E: Cannot link object foo.o as its attributes are incompatible with the image attributes.
... require 4-byte alignment of 8-byte datatypes clashes with require 8-byte alignment of 8-byte datatypes.

This can occur when linking RVCT objects with legacy objects built with ADS or RVCT 1.2. The Application Binary Interface (ABI) was changed between ADS and RVCT 2.0. In ADS and RVCT 1.2, "double" and "long long" data types were 4-byte aligned (unless -Oldrd or __align were used). In RVCT 2.0 onwards, "double" and "long long" data types are now 8-byte aligned, according to the new EABI.

These changes mean that legacy ADS/RVCT1.2 objects and libraries using "double" or "long long" data types are not directly compatible with RVCT 2.x/3.x objects/libraries, and so the linker will report an attribute clash.

Some compatibility is made possible, with some restrictions, by way of the --apcs /adsabi switch in RVCT 2.x/3.0. To allow RVCT 2.x/3.0 C objects to be used with legacy ADS C objects, compile the RVCT 2.x/3.0 C code with --apcs /adsabi (--apcs /adsabi was deprecated in RVCT 2.2 and removed from RVCT 3.1).

2) Error: L6242E: Cannot link object foo.o as its attributes are incompatible with the image attributes.
... pure-endian double clashes with mixed-endian double.

This can occur when linking RVCT or ADS objects with legacy SDT objects or objects built using --fpu softfpa or --fpu fpa. SDT uses a non standard format for little-endian 'double' and big-endian 'long long'. However ADS and RVCT use industry-standard 'double' and 'long long' types, except for when the --fpu softfpa and --fpu fpa are used. If you attempt to link object files that use the different formats for little-endian 'double' and big-endian 'long long' then the linker will report this error.

The recommended solution is to rebuild your entire project with RVCT. If you do not have the source code for an object or library, then try recompiling your RVCT code with --fpu softfpa (only supported in RVCT 2.1 and earlier).

3) Error: L6242E: Cannot link object foo.o as its attributes are incompatible with the image attributes.
... FPA clashes with VFP.

This error typically occurs when attempting to link objects built with different --fpu options. The recommended solution is to rebuild your entire project with RVCT, with the same --fpu options.

   


sansiloudeyu However ADS and RVCT use industry-standard 'double' and 'long long' types, except for when the --fpu softfpa and --fpu fpa are used 关键在这里,都是用ads编,有的enable了--fpu softfpa --fpu fpa 有的没有



sansiloudeyu /swst 支持stack-checked /nonswst 不支持stack-checked 关于stack-checked 可以到http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0234b/CDCCEIFG.html 搜索到,大概是用来支持stack 信息的如果这两项选项不一致会爆出: stack-checked clashes with not-stack-checked.


网友第二条回复解决问题。
页: [1]
查看完整版本: 请教:弹出错误 L6242E: Cannot link object __main.o as its attributes are incompa