Error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)"
I met this error when programming a WMI C++ query application.
Research:
MSDN
Says :When calling a function in a static library or DLL that takes a
wchar_t type (note that BSTR and LPWSTR resolve to wchar_t*), you may
get an LNK2001 unresolved external symbol error.This error is caused by
the /Zc:wchar_t compiler option, which is set to on by default in new
MFC projects. This option causes the compiler to treat wchar_t as a
native type. Before Visual C++ .NET, wchar_t was treated as an unsigned
short.If the main project and library do not use the same setting for
/Zc:wchar_t, this will cause a mismatch of function signatures. To avoid
this problem, rebuild the library with the /Zc:wchar_t compiler option,
or turn it off in the main project using the Treat wchar_t as Built-in
Type setting on the Language property page in the Property Pages dialog
box.
Solution:
Add this:
#ifdef _DEBUG
# pragma comment(lib, "comsuppwd.lib")
#else
# pragma comment(lib, "comsuppw.lib")
#endif
# pragma comment(lib, "wbemuuid.lib")
Reference:
ConvertStringToBSTR
http://msdn.microsoft.com/en-us/library/t58y75c0.aspx
Error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)"的更多相关文章
- 链接报error LNK2019: unresolved external symbol错误,解决
http://blog.163.com/aiding_001/blog/static/22908192011102224344450/ 某次编写一个COM组件,接口定义好之后,增加了ZRX代码后编译链 ...
- C++ win32 dll 引用外部CLR,加载托管程序集异常-Error 10 error LNK2019: unresolved external symbol _CLRCreateInstancet
异常: Error 10 error LNK2019: unresolved external symbol _CLRCreateInstance@12 referenced in function ...
- error LNK2019:unresolved external symbol
error LNK2019:unresolved external symbol 这个错误是指程序不认识函数.具体的说就是.h文件中定义并没有实现,这就是库出现了问题. 遇到这个问题,第一步就要看是哪 ...
- c++模板使用出错情况error LNK2019: unresolved external symbol "public: float __thiscall Compare<float>::min(void)" (?min@?$Compare@M@@QAEMXZ) referenced in function _main
将类模板在头文件中定义,类的成员函数在头文件中声明,头文件中只留下接口,函数的实现在另一个.cpp文件中,这样编译出来错误error LNK2019: unresolved external symb ...
- FreeType的项目总是报error LNK2019: unresolved external symbol __imp错误
用vs2013建立了一个c++的项目,然后在根目录放置了freetype.lib,将GitHub上面的include文件夹拷贝到本机,并且在VS中设置了额外包含目录指向这个inluce文件夹,然后将f ...
- C++ Error: error LNK2019: unresolved external symbol
在某工程中新添加了文件x.cu与x.hpp,实现了一些功能,最后编译整个工程的时候就出现了这个问题: error LNK2019: unresolved external symbol 这是链接错误, ...
- Error LNK2019:Unresolved External Symbol 的解决方案
当头文件中声明了一个函数,但是在相应的源文件中却没有对该函数进行定义,则会出现为“解决的外部符号”(unresolved external symbol )错误.另外,当一个函数调用了外部的一个库文件 ...
- VS2015 MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
今天在VS2015中用编译好的QT5静态库打包软件,配置好QT的静态环境后, 发现报MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved ...
- error LNK2019 : unresolved external symbol Zbar配置问题
原文链接:https://blog.csdn.net/MengchiCMC/article/details/77871714 出现error LNK2019 : unresolved external ...
随机推荐
- Mac下safari、chrome打开开发者工具快捷键
mac下safari和chrome打开开发者工具的快捷键相同,都是option(alt)+command+i 这个是我的默认配置,没有更改过的.
- eclipse 中卸载插件的方法
卸载步骤: Help -> About Eclipse -> Installation Details -> "点到你要删除的插件,如EclipseME" –&g ...
- SqlServer Split函数
Create FUNCTION [dbo].[SplitToTable] ( @SplitString nvarchar(max), @Separator nvarchar(10)=' ' ) RET ...
- 【python】正则表达式
参考资料:http://deerchao.net/tutorials/regex/regex.htm 1.正则表达式基础 2.python 正则表达式 1.正则表达式基础 元字符: 其他语法: (1) ...
- poj 3264 Balanced Lineup 区间极值RMQ
题目链接:http://poj.org/problem?id=3264 For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) alw ...
- 推荐系统之LFM
这里我想给大家介绍另外一种推荐系统,这种算法叫做潜在因子(Latent Factor)算法.这种算法是在NetFlix(没错,就是用大数据捧火<纸牌屋>的那家公司)的推荐算法竞赛中获奖的算 ...
- 打印xls注意事项
1.ctrl+p 2.打印机选择 就绪的,不是脱机的,不要只看打印机的名字. 3.打印名单信息的话 要用横向打印 4.从数据库里导出来的数据xls可能在excel里没显示完全,比如学号.身份证号等(e ...
- ios 调用打印机
源码 无意中玩一个demo发现调用了打印机 才发现ios有快速调用打印机的功能. if ([UIPrintInteractionController isPrintingAvailable] == ...
- 平面最小割—BZOJ 1001
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1001 很有意思的题目,本来想直接上网络流,但是发现点太多,边太多2333. 直接网络流无法 ...
- HDU4542 小明系列故事——未知剩余系
大赞的数论题: 大致思路: 对于TYPE=1的情况,认为 X 中有 X-K个约数,求最小的X,X-K>0 那么化为B+K的约数为B, 我们知道(B+K)的约数<=2*SQRT(B+K);这 ...