PB5.0,编译出现错误:error C2220: warning treated as error - no object file generated
平台:PB5.0
小弟做一个内核时候,在build阶段出现一个错误,具体如下:
BUILD: [00:0000000029:PROGC ] Compiling \WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\ directory.
BUILD: [01:0000000036:PROGC ] Compiling .\kitldrv.c
BUILD: [01:0000000039:ERRORE] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(33) : error C2220: warning treated as error - no object file generated
BUILD: [01:0000000040:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(33) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000041:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(33) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000042:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(34) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000043:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(34) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000044:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(35) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000045:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(35) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000046:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(36) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000047:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(36) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000048:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(37) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000049:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(37) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000050:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(38) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000051:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(38) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000052:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(39) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000053:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(39) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000054:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(40) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000055:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(40) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000056:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(41) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000057:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(41) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000058:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(42) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000059:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(42) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000060:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(43) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000061:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(43) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000062:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(44) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000063:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(44) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000064:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(45) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000065:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitldrv.c(45) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000066:PROGC ] Compiling .\kitleth.c
BUILD: [01:0000000069:ERRORE] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitleth.c(126) : error C2220: warning treated as error - no object file generated
BUILD: [01:0000000070:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitleth.c(126) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'char [3]'
BUILD: [01:0000000071:WARNN ] E:\WINCE500\PLATFORM\855gme\Src\Kernel\Libs\Kitl\kitleth.c(126) : warning C4047: 'initializing' : 'UCHAR' differs in levels of indirection from 'OAL_KITL_ETH_DRIVER *'
BUILD: [01:0000000072:PROGC ] Linking E:\WINCE500\platform\855GME\lib\x86\retail\oal_kitl_855.lib
BUILD: [01:0000000074:ERRORE] LINK : fatal error LNK1181: cannot open input file 'obj\x86\retail\kitldrv.obj'
BUILD: [00:0000000076:PROGC ] Files Warnings Errors
BUILD: [00:0000000077:PROGC ] Midl 0 0 0
BUILD: [00:0000000078:PROGC ] Resource 0 0 0
BUILD: [00:0000000079:PROGC ] Message 0 0 0
BUILD: [00:0000000080:PROGC ] Precomp Header 0 0 0
BUILD: [00:0000000081:PROGC ] C/Cpp/Cxx 2 28 2
BUILD: [00:0000000082:PROGC ] Assembler 0 0 0
BUILD: [00:0000000083:PROGC ] Static Libraries 1 0 1
BUILD: [00:0000000084:PROGC ] Dll's 0 0 0
BUILD: [00:0000000085:PROGC ] Exe's 0 0 0
BUILD: [00:0000000086:PROGC ] Resx 0 0 0
BUILD: [00:0000000087:PROGC ] Csharp Targets 0 0 0
BUILD: [00:0000000088:PROGC ] Other 0 7 1
BUILD: [00:0000000089:PROGC ]
BUILD: [00:0000000090:PROGC ] Total 3 35 4
BUILD: [00:0000000091:PROGC ]
BUILD: [00:0000000092:PROGC ] 35 Warnings, 4 Errors
百度&goolge了下,说是警告被视为错误,有人说可以通过修改警告级别搞定,csdn上也有朋友遇到过类似问题,大家建议把相应的警告去掉,但是那个帖子虽然结贴但是也没说明白怎么解决的。
[解决办法]
在字符串前,增加TEXT,例如:TEXT(“IN”)
[解决办法]
这个问题很奇特,先做个标记先。
补丁至少要打到2008年,
[解决办法]
把对应的警告去掉就可以了
[解决办法]
写错了,应该是:
{0x0000, 0x0000, 0x004033, EDBG_ADAPTER_NE2000, (UCHAR*)"AD", &DrvNE2k }, /* Addtron */\
...
少了一个星号。如果你看一下SUPPORTED_NIC的定义就知道,"AD"一项对应的数据类型应为UCHAR*,"AD"的类型会被视为CHAR*,最新的C++编译器会报警告。用强制转换就没事了。
typedef struct _SUPPORTED_NIC // NIC vendor ID
{
USHORT wVenId; // PCI Vendor ID
USHORT wDevId; // PCI Device ID
DWORD dwUpperMAC; // 1st 3 bytes of mac address
UCHAR Type; // adapter type
UCHAR BaseAddressRegisterOffset; // Base Address Register offset used to match to dwIoBase in InitKitlNIC
UCHAR szAbbrev[3]; // Vendor name abbreviation
const OAL_KITL_ETH_DRIVER *pDriver; // corresponding driver
} SUPPORTED_NIC, *PSUPPORTED_NIC;
[解决办法]
没用过PB5
[解决办法]
路过,关注!
[解决办法]