VS字符集设置影响编译成功与否
我使用开源库 muParser,是用来解析算式的
示例代码 :
使用 VS2019 ,必须将项目字符集设置成 “使用多字节字符集”,才能编译成功。
如果使用默认 “Unicode"字符集,IDE 会检测出类型错误:
E0415 不存在从 "const char [10]" 转换到 "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>" 的适当构造函数 ConsoleApplication1
C2664 “void mu::ParserBase::SetExpr(const mu::string_type &)”: 无法将参数 1 从“const char [10]”转换为“const mu::string_type &” ConsoleApplication1
我将 "" 号字符串替换成 _T("") ,IDE 类型错误消失,但编译时报错:
错误 LNK2019 无法解析的外部符号 "__declspec(dllimport) public: void __cdecl mu::ParserBase::SetExpr(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (__imp_?SetExpr@ParserBase@mu@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z),函数 main 中引用了该符号 ConsoleApplication1
好像是无法连接动态库
请问,如果我一定要用 Unicode 字符集,这个问题能解决吗?
示例代码 :
#include <iostream>
#include "muParser.h"
int main(int argc, char* argv[])
{
double var_a = 1;
mu::Parser p;
p.SetExpr("3*8+9-1/8");
std::cout << p.Eval() << std::endl;
return 0;
}
使用 VS2019 ,必须将项目字符集设置成 “使用多字节字符集”,才能编译成功。
如果使用默认 “Unicode"字符集,IDE 会检测出类型错误:
E0415 不存在从 "const char [10]" 转换到 "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>" 的适当构造函数 ConsoleApplication1
C2664 “void mu::ParserBase::SetExpr(const mu::string_type &)”: 无法将参数 1 从“const char [10]”转换为“const mu::string_type &” ConsoleApplication1
我将 "" 号字符串替换成 _T("") ,IDE 类型错误消失,但编译时报错:
错误 LNK2019 无法解析的外部符号 "__declspec(dllimport) public: void __cdecl mu::ParserBase::SetExpr(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (__imp_?SetExpr@ParserBase@mu@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z),函数 main 中引用了该符号 ConsoleApplication1
好像是无法连接动态库
请问,如果我一定要用 Unicode 字符集,这个问题能解决吗?
...全文
相关推荐
PCRE window VS工程
PCRE window VS工程
VC6到VS2010迁移所有问题的解决方法
由VC6.0开发的工程项目,移植到VS2010环境下,会出现各种错误和警告,此类错误多数是由编译器和环境不兼容导致,除修改工程下的某些属性参数外,还需手动修改编译过程中出现的一些错误。
vc6升级到vs2010部分解决方法
MFC程序,vc6升级到vs2010部分解决方法
vs配置说明文档 纯手工打造
该文档主要介绍vs2015下c++工程的各项配置的具体含义用法等。
vc6.0与vs2005的编码区别
vc6.0与vs2005的编码区别,里面介绍了两种不同的开发工具进行编码的区别,都是本人在开发过程中的总结,虽然不能全部列举区别,但也尽量力求全面。


