The error message “C2220: warning treated as error - no 'object' file generated” is output when the compiler option -WX is enabled and the code being compiled has a warning. When building with Platform Builder, the –WX compiler option is added when the environment variable WARNISERROR is set.
WARNISERROR is a handy environment variable for managing compiler warnings. With WARNISERROR set, warnings will cause the build to fail and therefore causes Software Engineers to clean up their code.
The error “C2220: warning treated as error - no 'object' file generated” will be output before the warning, so to find the cause of the error you must look down in the build output.
I wrote the following code to cause the error:
DWORD WarnIsError()
{
}
When built, the compiler outputs the following:
BUILD: [01:0000000034:ERRORE] c:\...\warniserror.c(33) : error C2220: warning treated as error - no 'object' file generated
BUILD: [01:0000000035:WARNN ] c:\...\ warniserror.c(33) : warning C4716: 'WarnIsError' : must return a value
So just for fun, I fixed that warning with:
DWORD WarnIsError()
{
DWORD Variable;
return Variable;
}
When built, the compiler outputs the following, as I expected:
BUILD: [01:0000000034:ERRORE] c:\...\ warniserror.c(34) : error C2220: warning treated as error - no 'object' file generated
BUILD: [01:0000000035:WARNN ] c:\...\ warniserror.c(34) : warning C4700: local variable 'Variable' used without having been initialized
These examples are simple, but they give you an idea about the value of WARNISERROR.
For more on the Platform Builder build system take a look at: Summary of Building Windows CE which lists the articles that I have written about building Windows CE using Platform Builder.
--------------------------------------------------------------------------------------------------------------------------------------------
导致这个问题的根本原因在那里?期待有更好的解决方法。
受高人指点,把有问题的文件用记事本打开,然后由ANSI格式存为UNICODE格式,同时将PLATFORM\COMMON\SRC\SOC下的dirs文件内容中的*改成了dirs=\ATMEL\
然后编译通过。
文章评论(0条评论)
登录后参与讨论