错误:argument of type "char *" is incompatible with parameter of type "LPCWSTR"
来源:互联网 发布:信捷plc编程电缆dvp 编辑:程序博客网 时间:2024/05/21 17:52
方法一:
方法一只针对新手,在vs2010中修改编码格式:
右键工程——》
选择“properties”——》
选择“configuration properties”——》
再选择“general”——》
最后把“project default”下的“character set”修改为“use multi-byte character set”(默认为“use unicode character set”)
这样对新手来说,就省了很多类型显示转换的工夫。但是这对学习windows不好,因为这样无法理解windows编程的特性、字符格式的原理。有精力还是不要用方法一,多折腾下就好了,请看方法二和三,会学到很多东西的。学习编程都是这样,不要贪图闲逸,一定要不畏苦难,遇到困难要想方设法搞懂:
1.为什么会出现这种错误?
2.出现这种错误的解决方法?
3.哪种方法最好,为什么?
4.联想自己遇到过的类似问题,比较、思考、总结。
相信你这样子会走得更远。
方法二:
方法二要引入 #include<tchar.h>
才能使用text等进行转换
lpcwstr str1 = text(“hello”);
lpcwstr str2 = l”hello”;
lpcwstr str3 = _t(“hello”);
方法三:
这种是针对使用变量来存储字符串的解决方法。
const char* ch = “hello”;
wchar wch[6];
multibytetowidechar( 0,0, ch, 5, wch, 6);
lpcwstr str4 = wch;
引用地址
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误:argument of type "char *" is incompatible with parameter of type "LPCWSTR"
- angular Argument of type '"price"' is not assignable to parameter of type 'string[]'
- 【Ionic】Argument of type“**Service”is not assignable to parameter of type 'RebirthHttp'.
- Cannot initialize a parameter of type 'char **' with
- 使用cuDNN5编译py-faster-rcnn错误:cudnn.hpp(126): error: argument of type "int" is incompatible ...
- Sending 'ccColor4B' (aka 'struct _ccColor4B') to parameter of incompatible type 'CIColor *'错误
- Sending 'ViewController' to Parameter of Incompatible Type 'id<xxxDelegate>'
- No parameter name specified for argument of type
- Initializing 'AppDelegate *__strong' with an expression of incompatible type
- 闭包错误-Cannot invoke 'responseResult' with an argument list of type
- Swift*Cannot invoke 'jsonObject' with an argument list of type
- java.lang.IllegalStateException: Argument [RedirectAttributes] is of type Model
- TypeError: argument of type 'int' is not iterable
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- 僵尸进程和孤儿进程
- js 正则验证手机号
- [Pandas] 10分钟Pandas之旅 01
- 感染病毒WannaCry? 信息安全有华胜信泰
- 错误:argument of type "char *" is incompatible with parameter of type "LPCWSTR"
- 关于 MYSQL5.6 版本 my.ini 文件的位置
- Ubuntu linux 快速入门
- AJAX多级下拉联动【JSON】
- JAVA中设置了线程优先级,能保证这个线程一定先执行吗?
- 欢迎使用CSDN-markdown编辑器
- 使用Intellij Idea+Gradle 搭建Java 本地开发环境
- SVM解二分类,多分类,及后验概率输出
- 学习PHP