MainApp\RPolarView.cpp(1571): error C2664: “ATL::CStringT<BaseType,StringTraits>::ReverseFind”: 不能将参数 1 从“const char [2]”转换为“wchar_t”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> 没有使该转换得以执行的上下文

CString GetModulePath(CString name)
{
char lpFilename[];
DWORD nSize = ;
// 得到应用程序的文件名
GetModuleFileName(NULL,L"lpFilename",nSize);
CString strFileName = (CString)lpFilename;
int pos = strFileName.ReverseFind("\\");
if(pos<)
return L"";
return strFileName.Left(pos+)+name;
};

改成:

即可

CString GetModulePath(CString name)
{
char lpFilename[];
DWORD nSize = ;
// 得到应用程序的文件名
GetModuleFileName(NULL,L"lpFilename",nSize);
CString strFileName = (CString)lpFilename;
int pos = strFileName.ReverseFind('\\');
if(pos<)
return L"";
return strFileName.Left(pos+)+name;
};

Error:“const char*”类型的实参与“wchar_t”类型的形参不兼容的更多相关文章

  1. Error:const char* 类型的实参和LPCWSTR类型的形参不兼容的解决方法。

    在C++的Windows 应用程序中经常碰到这种情况. 解决方法: 加入如下转换函数: LPCWSTR stringToLPCWSTR(std::string orig) { size_t origs ...

  2. C++编译遇到参数错误(cannot convert parameter * from 'const char [**]' to 'LPCWSTR')

    转:http://blog.sina.com.cn/s/blog_9ffcd5dc01014nw9.html 前面的几天一直都在复习着被实习落下的C++基础知识.今天在复习着上次创建的窗口程序时,出现 ...

  3. error C2678: 二进制“+”: 没有找到接受“const char [22]”类型的左操作数的运算符(或没有可接受的转换)没有与这些操作数匹配的“+”运算符

    错误:没有与这些操作数匹配的“+”运算符,操作数类型为const char [20]+CString 分析原因:其提示操作数类型为const char [20]+CString 可见是类型有问题 故加 ...

  4. error C2664: “LoadLibraryW”: 不能将参数 1 从“const char *”转换为“LPCWSTR”

    在使用VS2010编写运行时动态链接dll文件时出现的一个问题,问题解决得益于此文章: http://blog.sina.com.cn/s/blog_6a2236590100xbgl.html 通过调 ...

  5. 【VS2013编译DirectX Tutorials时遇到的错误】"const wchar_t *" 类型的实参与 "LPCSTR" 类型的形参不兼容

    本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/p/3696367.html 通过查看LPCSTR的定义: typedef _Null_te ...

  6. VS2010 error C2664: “CWnd::MessageBoxW”: 不能将参数 1 从“const char [3]”转换为“LPCTSTR”

    VS2010 (VC2010)建立工程时默认的字符集是Unicode,所以在代码中使用MessageBox时需要输入Unicode,用TEXT()这个宏输入参数,否则会报错:   代码:Message ...

  7. error: C2664: “zajiao::zajiao(const zajiao &)”: 无法将参数 1 从“const char [12]”转换为“char *”

    原本打算在QT用一个字符串"ABCDEF12345"作为类zajiao的构造函数的参数,用来创建类zajiao的对象zajiao1. zajiao zajiao1("AB ...

  8. error: no matching function for call to 'std::exception:exception(const char[16])'

    环境:codeblocks 语言:C++ 在执行:throw new exception("queue is empty.");时 遇到问题:error: no matching ...

  9. C++ Error C2664:无法将参数 1 从“const char [9]”转换为“LPCWSTR”解决方案

    问题出现 编译平台:VS2013     Windows 出现地方:在使用LoadLibrary( )函数动态链接DLL文件时出现的一个问题 Eg.   在使用 UNICODE字符的工程中,  HIN ...

随机推荐

  1. 【Todo】Apache-Commons-Pool及对象池学习

    有这篇文章: http://www.cnblogs.com/tommyli/p/3510095.html 方案提供了三种类型的pool,分别是GenericKeyedObjectPool,SoftRe ...

  2. FL2440 rt3070模块station模式移植

    ---------------------------------------------------------------------------------------------------- ...

  3. csharp 面向对象编程

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Shap ...

  4. chromatic aberration

    https://github.com/keijiro/KinoFringe https://en.wikipedia.org/wiki/Chromatic_aberration 色差偏移 做神经病效果 ...

  5. mysql 5.7.13 安装配置方法(linux)-后期部分运维

    mysql 5.7.13 安装配置方法图文教程(linux) 学习了:https://www.cnblogs.com/zhao1949/p/5947938.html /usr/local/mysql是 ...

  6. [Javascript] Write a Generator Function to Generate the Alphabet / Numbers

    When you need to generate a data set, a generator function is often the correct solution. A generato ...

  7. 解决ie下载apk后更改后缀名为.zip的问题

    转自:http://www.cnblogs.com/niuniu/archive/2012/03/06/2381811.html 解决: 服务器添加MIME类型: application/vnd.an ...

  8. BIN文件如何打开

    有些BIN文件用DAEMON Tools也无法打开 但是UltraISO可以打开,我们看到有Setup.exe,但是如果直接双击无法运行.我们可以先把所有东西都提取出来.   这样之后再点击Setup ...

  9. 常见的开发语言(或IT技术)一览

    Java. Android. iOS. Web前端. Python. .NET. PHP. C/C++. Linux 数据库技术

  10. Asp.Net WebApi服务端解决跨域方案

    1.特性方式 主要是继承ActionFilterAttribute,重写OnActionExecuted方法,在action执行后,给响应头加上一个键值对. using System.Web.Http ...