{"id":6173,"date":"2016-12-15T23:32:14","date_gmt":"2016-12-15T14:32:14","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6173"},"modified":"2017-01-20T01:13:23","modified_gmt":"2017-01-19T16:13:23","slug":"windows-%e4%b8%8a%e3%81%a7%e3%81%ae-visual-c-%e3%81%a8-gccclang-%e3%81%ae%e7%9b%b8%e4%ba%92%e9%81%8b%e7%94%a8%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%96%ef%bc%89","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6173","title":{"rendered":"Windows \u4e0a\u3067\u306e Visual C++ \u3068 GCC\/Clang \u306e\u76f8\u4e92\u904b\u7528\uff08\u305d\u306e\uff16\uff09"},"content":{"rendered":"<p><a href=\"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6163\">\u305d\u306e\uff15<\/a>\u306e\u7d9a\u304d<\/p>\n<p>\u3068\u3066\u3082\u30c0\u30e1\u305d\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u304c\u3001C++ \u306e\u4f8b\u5916\u306f\u4f7f\u3048\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u305d\u306e\uff15\u306e\u7d50\u679c\u304b\u3089\u30af\u30e9\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6271\u3048\u308b\u3068\u306f\u601d\u3048\u306a\u3044\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a <code>int<\/code> \u3067\u3082 <code>throw<\/code> \u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>umezawa@selene ~$ cat extest1_callee.cc\r\nextern \"C\" void foo()\r\n{\r\n        throw int(1);\r\n}\r\n\r\numezawa@selene ~$ cat extest1_main.cpp\r\n#include &lt;stdio.h&gt;\r\n\r\nextern \"C\" void foo();\r\n\r\nint main(void)\r\n{\r\n        try\r\n        {\r\n                foo();\r\n        }\r\n        catch (int i)\r\n        {\r\n                printf(\"%d\\n\", i);\r\n        }\r\n\r\n        return 0;\r\n}\r\n\r\numezawa@selene ~$ g++ -o extest1_callee.obj -c extest1_callee.cc\r\n\r\n<\/pre>\n<\/blockquote>\n<blockquote>\n<pre>\r\nc:\\cygwin\\home\\umezawa&gt;cl \/EHsc extest1_main.cpp extest1_callee.obj\r\nMicrosoft(R) C\/C++ Optimizing Compiler Version 19.00.24215.1 for x86\r\nCopyright (C) Microsoft Corporation.  All rights reserved.\r\n\r\nextest1_main.cpp\r\nMicrosoft (R) Incremental Linker Version 14.00.24215.1\r\nCopyright (C) Microsoft Corporation.  All rights reserved.\r\n\r\n\/out:extest1_main.exe\r\nextest1_main.obj\r\nextest1_callee.obj\r\nextest1_callee.obj : error LNK2019: \u672a\u89e3\u6c7a\u306e\u5916\u90e8\u30b7\u30f3\u30dc\u30eb __ZTIi \u304c\u95a2\u6570 _foo \u3067\u53c2\u7167\u3055\u308c\u307e\u3057\u305f\u3002\r\nextest1_callee.obj : error LNK2019: \u672a\u89e3\u6c7a\u306e\u5916\u90e8\u30b7\u30f3\u30dc\u30eb ___cxa_allocate_exception \u304c\u95a2\u6570 _foo \u3067\u53c2\u7167\u3055\u308c\u307e\u3057\u305f\u3002\r\nextest1_callee.obj : error LNK2019: \u672a\u89e3\u6c7a\u306e\u5916\u90e8\u30b7\u30f3\u30dc\u30eb ___cxa_throw \u304c\u95a2\u6570 _foo \u3067\u53c2\u7167\u3055\u308c\u307e\u3057\u305f\u3002\r\nextest1_main.exe : fatal error LNK1120: 3 \u4ef6\u306e\u672a\u89e3\u6c7a\u306e\u5916\u90e8\u53c2\u7167\r\n\r\nc:\\cygwin\\home\\umezawa><\/pre>\n<\/blockquote>\n<p>\u30ea\u30f3\u30af\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u308c\u3001<code>throw<\/code> \u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3053\u308d\u3067\u65e2\u306b\u30c0\u30e1\u306a\u306e\u3067\u3001\u547c\u3070\u308c\u305f\u5074\u304c\u4f8b\u5916\u3092\u6f0f\u3089\u3055\u306a\u3044\u3088\u3046\u306b\u66f8\u3044\u3066\u3082\u30c0\u30e1\u3067\u3059\u3002 libgcc.a \u3084 libgcc_eh.a \u3092\u8ffd\u52a0\u3057\u3066\u3082\u3084\u3063\u3071\u308a\u30c0\u30e1\u3067\u3057\u305f\u3002\u8ae6\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6253\">\u305d\u306e\uff17<\/a>\u306b\u7d9a\u304f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u305d\u306e\uff15\u306e\u7d9a\u304d \u3068\u3066\u3082\u30c0\u30e1\u305d\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u304c\u3001C++ \u306e\u4f8b\u5916\u306f\u4f7f\u3048\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-6173","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6173"}],"version-history":[{"count":5,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6173\/revisions"}],"predecessor-version":[{"id":6261,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6173\/revisions\/6261"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}