illegal use of this type as an expression 解决方案

本文详细介绍了在使用VC6.0编译DLL程序时遇到errorC2275错误的解决方法,并通过对比不同版本的编译器发现该问题在VS2008中得以解决。文中还提到可能有其他解决方案,作者计划后续查找并分享。

今天用VC6.0编译DLL程序,出现如下错误

: error C2275: 'TRAYDATA' : illegal use of this type as an expression
: see declaration of 'TRAYDATA'

 

 

解决方案:

用VS2008编译就没问题。

或许还有其他解决方案,我没看到,等把手头工作做完查查看。

 

 

 

 

 

这个代码用VC++6.0编译出错,显示“-------------------Configuration: 123344 - Win32 Debug-------------------- Compiling... 123.c c:\users\administrator\desktop\新建文件夹\123344\123.c(76) : error C2275: 'HashNode' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(21) : see declaration of 'HashNode' c:\users\administrator\desktop\新建文件夹\123344\123.c(76) : error C2065: 'new_node' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(77) : error C2223: left of '->record' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(78) : error C2223: left of '->next' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(82) : error C2275: 'HashNode' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(21) : see declaration of 'HashNode' c:\users\administrator\desktop\新建文件夹\123344\123.c(82) : error C2065: 'current' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(83) : error C2223: left of '->next' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(84) : error C2223: left of '->next' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(86) : error C2223: left of '->next' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(88) : warning C4047: '=' : 'struct HashNode *' differs in levels of indirection from 'int ' c:\users\administrator\desktop\新建文件夹\123344\123.c(104) : error C2275: 'HashNode' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(21) : see declaration of 'HashNode' c:\users\administrator\desktop\新建文件夹\123344\123.c(104) : error C2065: 'node' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(106) : warning C4047: '==' : 'int ' differs in levels of indirection from 'void *' c:\users\administrator\desktop\新建文件夹\123344\123.c(110) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(111) : warning C4047: '!=' : 'int ' differs in levels of indirection from 'void *' c:\users\administrator\desktop\新建文件夹\123344\123.c(112) : error C2065: 'is_phone' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(112) : error C2223: left of '->record' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(112) : error C2198: 'strcmp' : too few actual parameters c:\users\administrator\desktop\新建文件夹\123344\123.c(113) : error C2223: left of '->record' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(113) : error C2198: 'strcmp' : too few actual parameters c:\users\administrator\desktop\新建文件夹\123344\123.c(116) : error C2223: left of '->record' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(116) : warning C4033: 'search_record' must return a value c:\users\administrator\desktop\新建文件夹\123344\123.c(118) : error C2223: left of '->next' must point to struct/union c:\users\administrator\desktop\新建文件夹\123344\123.c(141) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2143: syntax error : missing ')' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2065: 'i' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : warning C4552: '<' : operator has no effect; expected operator with side-effect c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2059: syntax error : ')' c:\users\administrator\desktop\新建文件夹\123344\123.c(142) : error C2143: syntax error : missing ';' before '{' c:\users\administrator\desktop\新建文件夹\123344\123.c(144) : error C2065: 'used_buckets' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2143: syntax error : missing ')' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : warning C4552: '<' : operator has no effect; expected operator with side-effect c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2059: syntax error : ')' c:\users\administrator\desktop\新建文件夹\123344\123.c(152) : error C2143: syntax error : missing ';' before '{' c:\users\administrator\desktop\新建文件夹\123344\123.c(205) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(215) : error C2065: 'choice' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(237) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(238) : error C2275: 'Record' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(16) : see declaration of 'Record' c:\users\administrator\desktop\新建文件夹\123344\123.c(238) : error C2065: 'found' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(238) : error C2065: 'search_length' : undeclared identifier c:\users\administrator\desktop\新建文件夹\123344\123.c(239) : warning C4047: 'function' : 'struct Record *' differs in levels of indirection from 'int ' c:\users\administrator\desktop\新建文件夹\123344\123.c(239) : warning C4024: 'print_record' : different types for formal and actual parameter 1 c:\users\administrator\desktop\新建文件夹\123344\123.c(249) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(250) : error C2275: 'Record' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(16) : see declaration of 'Record' c:\users\administrator\desktop\新建文件夹\123344\123.c(251) : warning C4047: 'function' : 'struct Record *' differs in levels of indirection from 'int ' c:\users\administrator\desktop\新建文件夹\123344\123.c(251) : warning C4024: 'print_record' : different types for formal and actual parameter 1 c:\users\administrator\desktop\新建文件夹\123344\123.c(261) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(262) : error C2275: 'Record' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(16) : see declaration of 'Record' c:\users\administrator\desktop\新建文件夹\123344\123.c(263) : warning C4047: 'function' : 'struct Record *' differs in levels of indirection from 'int ' c:\users\administrator\desktop\新建文件夹\123344\123.c(263) : warning C4024: 'print_record' : different types for formal and actual parameter 1 c:\users\administrator\desktop\新建文件夹\123344\123.c(273) : error C2143: syntax error : missing ';' before 'type' c:\users\administrator\desktop\新建文件夹\123344\123.c(274) : error C2275: 'Record' : illegal use of this type as an expression c:\users\administrator\desktop\新建文件夹\123344\123.c(16) : see declaration of 'Record' c:\users\administrator\desktop\新建文件夹\123344\123.c(275) : warning C4047: 'function' : 'struct Record *' differs in levels of indirection from 'int ' c:\users\administrator\desktop\新建文件夹\123344\123.c(275) : warning C4024: 'print_record' : different types for formal and actual parameter 1 2357.cpp 执行 cl.exe 时出错.”应该如何修改?完整版的代码是什么?
最新发布
11-05
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值