{"id":515,"date":"2014-08-30T23:30:37","date_gmt":"2014-08-30T15:30:37","guid":{"rendered":"http:\/\/blog.sorayuki.net\/?p=515"},"modified":"2016-07-27T02:43:19","modified_gmt":"2016-07-26T18:43:19","slug":"windowsddk%e9%87%8c%e7%94%a8stdwstring%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog.sorayuki.net\/?p=515","title":{"rendered":"WindowsDDK\u91cc\u7528std::wstring\u7684\u95ee\u9898"},"content":{"rendered":"<p>\u4eca\u5929\u665a\u4e0a\u5c1d\u8bd5\u5e2e\u67d0\u7f51\u53cb\u5236\u4f5c\u4e00\u4e2a\u4f2a\u6625\u83dc\u7684\u63d2\u4ef6\uff0c\u80fd\u591f\u68c0\u67e5\u4e24\u6b21\u8c03\u7528\u8fc7\u7a0b\u4e2d\u526a\u8d34\u677f\u91cc\u9762\u7684\u4e1c\u897f\u6709\u6ca1\u6709\u53d8\u5316\uff08\u7528GetClipboardSequenceNumber\u51fd\u6570\uff09\u548c\u83b7\u53d6\u526a\u8d34\u677f\u91cc\u7684\u5185\u5bb9\uff08EnumClipboardFormats\u548cGetClipboardData\uff09\u3002\u8fd9\u91cc\u90fd\u4e0d\u662f\u91cd\u70b9\uff0c\u91cd\u70b9\u662f\u6211\u7528\u4e86 <a href=\".\/?p=9\">\u8fd9\u4e00\u7bc7\u535a\u5ba2<\/a> \u91cc\u9762\u63d0\u5230\u7684CSaori\u5e93\u6765\u7f16\u5199\u3002\u8fd9\u4e2a\u5e93\u91cc\u9762\u7684\u5b57\u7b26\u662fwchar_t\u7c7b\u578b\uff0c\u8fd9\u5f88\u597d\uff0c\u4e5f\u7528\u4e86std::basic_string&lt;wchar_t&gt;\uff08\u5176\u5b9e\u5c31\u662fstd::wstring\uff09\uff0c\u8fd9\u4e5f\u5f88\u597d\u3002\u4e0d\u597d\u7684\u5730\u65b9\u5728\u4e8e\uff0c\u6211\u4e3a\u4e86\u51cf\u5c0f\u6700\u7ec8DLL\u7684\u4f53\u79ef\u3001\u7528Windows Driver Kit\u91cc\u9762\u7684\u7f16\u8bd1\u5668\u6765\u7f16\u8bd1\u7a0b\u5e8f\u4f7f\u5f97\u52a8\u6001\u94fe\u63a5\u5230\u8fd0\u884c\u5e93\u7684\u65f6\u5019\uff0c\u62a5\u9519\u4e86\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u7a0b\u5e8f\u672c\u8eab\u662f\u6ca1\u6709\u95ee\u9898\uff0c\u56e0\u4e3a\u6211\u7528VS2010\u7f16\u8bd1\u5668\u7f16\u8bd1\u5b83\u5c31\u6b63\u5e38\uff0c\u800c\u4e14\u8fd8\u80fd\u8fd0\u884c\uff0c\u8fd0\u884c\u8d77\u6765\u4e5f\u6ca1\u95ee\u9898\u3002\u4ed4\u7ec6\u67e5\u770bDDK\u7f16\u8bd1\u5668\u7684\u62a5\u9519\u4fe1\u606f\uff0c\u5927\u6982\u662f<\/p>\n<pre style=\"height: 221px; width: 696px\">error LNK2019: unresolved external symbol \"__declspec(dllimport) p\nublic: wchar_t&amp; __thiscall std::basic_string&lt;wchar_t,struct std::char_traits&lt;wch\nar_t&gt;,class std::allocator&lt;wchar_t&gt; &gt;::operator[](unsigned int)\" (__imp_??A?$bas\nic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAA_WI@Z) reference\nd in function \"public: bool __thiscall CSAORIInput::parseString(class std::basic\n_string&lt;wchar_t,struct std::char_traits&lt;wchar_t&gt;,class std::allocator&lt;wchar_t&gt; &gt;\n const &amp;)\" (?parseString@CSAORIInput@@QAE_NABV?$basic_string@_WU?$char_traits@_W\n@std@@V?$allocator@_W@2@@std@@@Z)<\/pre>\n<p>\u8fd9\u4e2a\u6837\u5b50\u7684\uff0c\u76ee\u6d4b\u610f\u601d\u662f\u94fe\u63a5\u4e0d\u4e0astd::wstring\u3002<\/p>\n<p>\u611f\u89c9\u4e0d\u5e94\u8be5\u554a\uff0c\u5b83\u4e0d\u662f\u652f\u6301\u5bbd\u5b57\u7b26\u5b57\u7b26\u4e32\u5bf9\u8c61\u7684\u5417\u3002\u7136\u540e\u4e0a\u7f51\u641c\u641c\u51fa\u4e86\u8fd9\u4e48\u4e00\u4e2a\u4e1c\u897f\uff1a<\/p>\n<p><a title=\"http:\/\/stackoverflow.com\/questions\/5988457\/is-wchar-t-supported-in-c-wdk-stl-i-get-unresolved-external-symbols\" href=\"http:\/\/stackoverflow.com\/questions\/5988457\/is-wchar-t-supported-in-c-wdk-stl-i-get-unresolved-external-symbols\">http:\/\/stackoverflow.com\/questions\/5988457\/is-wchar-t-supported-in-c-wdk-stl-i-get-unresolved-external-symbols<\/a><\/p>\n<p>\u611f\u89c9\u597d\u5751\u2026\u2026\u7f16\u8bd1\u5668\u548c\u5e93\u4e0d\u591f\u5339\u914d\u7684\u7ed3\u679c\u5417\u3002\u5e93\u7528\u7684\u662fVC6.0\u91cc\u9762\u7684\u5427\uff0c\u4f46\u662f\u56e0\u4e3a\u7f16\u8bd1\u5668\u662f\u65b0\u7684\uff0c\u9ed8\u8ba4wchar_t\u662f\u5185\u7f6e\u7c7b\u578b\uff0c\u800c\u5e93\u5e76\u4e0d\u662f\u8fd9\u6837\u7684\uff0c\u6700\u7ec8\u94fe\u4e0d\u4e0a\u3002<\/p>\n<p>\u6700\u7ec8\u52a0\u4e0a\u4e86 \/Zc:wchar_t- \u53c2\u6570\uff0c\u5b83\u5c31\u597d\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u665a\u4e0a\u5c1d\u8bd5\u5e2e\u67d0\u7f51\u53cb\u5236\u4f5c\u4e00\u4e2a\u4f2a\u6625\u83dc\u7684\u63d2\u4ef6\uff0c\u80fd\u591f\u68c0\u67e5\u4e24\u6b21\u8c03\u7528\u8fc7\u7a0b\u4e2d\u526a\u8d34\u677f\u91cc\u9762\u7684\u4e1c\u897f\u6709\u6ca1\u6709\u53d8\u5316\uff08\u7528GetClipb &hellip; <a href=\"https:\/\/blog.sorayuki.net\/?p=515\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">WindowsDDK\u91cc\u7528std::wstring\u7684\u95ee\u9898<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,11,15],"tags":[],"class_list":["post-515","post","type-post","status-publish","format-standard","hentry","category-vc","category-windows","category-15"],"_links":{"self":[{"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=\/wp\/v2\/posts\/515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=515"}],"version-history":[{"count":0,"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=\/wp\/v2\/posts\/515\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sorayuki.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}