{"id":1154,"date":"2020-01-15T01:51:40","date_gmt":"2020-01-14T17:51:40","guid":{"rendered":"https:\/\/gnonstop.linkpc.net\/wp\/?p=1154"},"modified":"2025-08-22T21:39:27","modified_gmt":"2025-08-22T13:39:27","slug":"error-%e7%9a%84%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95-c","status":"publish","type":"post","link":"https:\/\/guerilla.ddns.net\/wp\/?p=1154","title":{"rendered":"C++ #error \u7684\u4f7f\u7528\u65b9\u6cd5"},"content":{"rendered":"<p>#error \u6307\u793a\u8a5e\u6703\u5728\u7de8\u8b6f\u6642\u671f\u767c\u51fa\u4f7f\u7528\u8005\u6307\u5b9a\u7684\u932f\u8aa4\u8a0a\u606f\u4e26\u7d50\u675f\u7de8\u8f2f\u3002<\/p>\n<p>C++ \u4f7f\u7528\u4f8b\u4e00\uff1a<\/p>\n<pre><code class=\"language-cpp\" data-line=\"\">#if !defined(__cplusplus)\n#error C++ compiler required.\n#endif<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>C++ \u4f7f\u7528\u4f8b\u4e8c\uff1a<\/p>\n<pre><code class=\"language-cpp\" data-line=\"\">#ifndef _M_AMD64\n#error Only working for x64 environment.\n#endif<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<br \/>\nref: <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/preprocessor\/hash-error-directive-c-cpp\" rel=\"noopener noreferrer\" target=\"_blank\">#error directive (C\/C++)<\/a><\/p>\n<p>&nbsp;<br \/>\n#C\/C++ #coding #programming<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#error \u6307\u793a\u8a5e\u6703\u5728\u7de8\u8b6f\u6642\u671f\u767c\u51fa\u4f7f\u7528\u8005\u6307\u5b9a\u7684\u932f\u8aa4\u8a0a\u606f\u4e26\u7d50\u675f\u7de8\u8f2f\u3002 C++ \u4f7f\u7528\u4f8b\u4e00\uff1a #if !defin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[212],"tags":[85,27,94],"class_list":["post-1154","post","type-post","status-publish","format-standard","hentry","category-coding","tag-c","tag-coding","tag-programming"],"_links":{"self":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1154"}],"version-history":[{"count":8,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1154\/revisions"}],"predecessor-version":[{"id":3402,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1154\/revisions\/3402"}],"wp:attachment":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}