error C2275: ‘XXX’ : illegal use of this type as an expression 报错的解决方法!
来源:互联网 发布:js map转为json字符串 编辑:程序博客网 时间:2024/04/27 17:32
//最简单的创建多线程实例#include<stdio.h>#include<windows.h>//子线程函数DWORD WINAPI ThreadFun(LPVOID pm){printf("子线程的线程ID号为:%d\n 子线程输出Hello World\n",GetCurrentThreadId());return 0;}//主函数,所谓主函数其实就是主线程执行的函数int main(){//HANDLE handle=CreateThread(NULL,0,ThreadFun,NULL,0,NULL);printf("最简单的创建多线程实例\n");printf("--by MoreWindows(http://blog.csdn.net/MoreWindows)--\n\n"); HANDLE handle=CreateThread(NULL,0,ThreadFun,NULL,0,NULL);WaitForSingleObject(handle,INFINITE);//WaitForSingleObject(CreateThread(NULL,0,ThreadFun,NULL,0,NULL),INFINITE);return 0;}
代码没问题
怀疑是纯C环境 比较老的版本
所以要求变量定义只能在开头
//最简单的创建多线程实例#include<stdio.h>#include<windows.h>//子线程函数DWORD WINAPI ThreadFun(LPVOID pm){printf("子线程的线程ID号为:%d\n 子线程输出Hello World\n",GetCurrentThreadId());return 0;}//主函数,所谓主函数其实就是主线程执行的函数int main(){HANDLE handle=CreateThread(NULL,0,ThreadFun,NULL,0,NULL);printf("最简单的创建多线程实例\n");printf("--by MoreWindows(http://blog.csdn.net/MoreWindows)--\n\n"); //HANDLE handle=CreateThread(NULL,0,ThreadFun,NULL,0,NULL);WaitForSingleObject(handle,INFINITE);//WaitForSingleObject(CreateThread(NULL,0,ThreadFun,NULL,0,NULL),INFINITE);return 0;}
这样编译器就没有报错了。
0 0
- error C2275: ‘XXX’ : illegal use of this type as an expression 报错的解决方法!
- error C2275! illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275: "xxx"illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275 illegal use of this type as an expression 解决方法
- 编译选项引发的ERROR C2275:illegal use of this type as an expression
- C2275 illegal use of this type as an expression
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275: 'time_t' : illegal use of this type as an expression
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275 : 'UNICODE_STRING' :illegal use of this type as an expression
- [C/C++]illegal use of this type as an expression报错的原因
- illegal use of this type as an expression 解决方案
- 'PIO_STACK_LOCATION' : illegal use of this type as an expression
- illegal use of this type as an expression
- HDU 4031 线段树
- pom Lifecycle Mapping Problem 问题
- c/c++ 输入输出
- 耦合性:软件系统结构中各模块间相互联系紧密程度的一种度量
- Light OJ 1197 - Help Hanzo
- error C2275: ‘XXX’ : illegal use of this type as an expression 报错的解决方法!
- HDOJ1002
- 常量指针和指针常量
- Android 返回桌面
- iOS 真机不能显示图片问题
- UVA - 10288 Coupons (概率+递推)
- 【坑】javascript中的prototype
- volatile关键字
- 用两个栈实现一个队列