{"id":117,"date":"2011-04-18T20:10:45","date_gmt":"2011-04-19T03:10:45","guid":{"rendered":"http:\/\/www.myopictopics.com\/?p=117"},"modified":"2014-02-24T08:05:51","modified_gmt":"2014-02-24T16:05:51","slug":"quickie-add-clickable-messages-to-your-visual-studio-error-list-window","status":"publish","type":"post","link":"https:\/\/www.myopictopics.com\/?p=117","title":{"rendered":"Quickie: Add clickable messages to your Visual Studio Error List Window"},"content":{"rendered":"<p>I had this kicking around on my hard drive, so I thought I &#8216;d throw it out there. It&#8217;s not\u00a0exactly a big secret, but it certainly amused me when I\u00a0wrote it. Use <span style=\"font-family: Courier; color: #0000ff;\">CWARNING<\/span> and <span style=\"font-family: Courier; color: #0000ff;\">CERROR<\/span> to add compile-time items to the Error List window in Visual Studio.<\/p>\n<p>This is Visual Studio specific, but can be adapted to work with other compilers and environments. The use of <span style=\"font-family: Courier; color: #0000ff;\">__pragma\u00a0<\/span>appears to be Microsoft-specific, but the C99 and C++11 standards introduce the <span style=\"font-family: Courier; color: #0000ff;\">_Pragma<\/span> keyword.<\/p>\n<pre><code>#<span style=\"color: #339966;\">ifndef <span style=\"color: #993366;\">_COMPILEWARNINGS_H_\r\n<\/span><\/span>#<span style=\"color: #339966;\">define <span style=\"color: #993366;\">_COMPILEWARNINGS_H_\r\n\r\n<\/span><\/span>#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__NUMTOSTRINGHELPER2<\/strong><\/span>(x)\t#x\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__NUMTOSTRINGHELPER<\/strong><\/span>(x)\t__NUMTOSTRINGHELPER2(x)\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__FILE_AND_LINE__<\/strong><\/span>       <span style=\"color: #ff0000;\">__FILE__<\/span>\"(\" __NUMTOSTRINGHELPER(<span style=\"color: #ff0000;\">__LINE__<\/span>) \")\"\r\n\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__ADDWARNING__<\/strong><\/span>(msg)     <span style=\"color: #ff0000;\">__FILE_AND_LINE__<\/span><span style=\"color: #993366;\">\" : warning : \"<\/span> <span style=\"color: #339966;\"><strong>msg<\/strong><\/span>\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__ADDERROR__<\/strong><\/span>(msg)       <span style=\"color: #ff0000;\">__FILE_AND_LINE__<\/span><span style=\"color: #993366;\">\" : error : \"<\/span> <strong><span style=\"color: #339966;\">msg<\/span>\r\n<span style=\"color: #999999;\">\/\/ edit 2014-24-02 - CINFO is not correct...still looking for the answer here<\/span><\/strong>\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>__ADDINFO__<\/strong><\/span>(msg)        <span style=\"color: #ff0000;\">__FILE_AND_LINE__<\/span><span style=\"color: #993366;\">\" : info : \"<\/span> <strong><span style=\"color: #339966;\">msg<\/span><\/strong>\r\n\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>CWARNING<\/strong><\/span>(msg)           <span style=\"color: #339966;\">__pragma<\/span>(<span style=\"color: #0000ff;\">message<\/span>(__ADDWARNING__(<span style=\"color: #339966;\"><strong>msg<\/strong><\/span>)))\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>CERROR<\/strong><\/span>(msg)             <span style=\"color: #339966;\">__pragma<\/span>(<span style=\"color: #0000ff;\">message<\/span>(__ADDERROR__(<strong><span style=\"color: #339966;\">msg<\/span><\/strong>)))\r\n#<span style=\"color: #339966;\">define <\/span><span style=\"color: #333399;\"><strong>CINFO<\/strong><\/span>(msg)              <span style=\"color: #339966;\">__pragma<\/span>(<span style=\"color: #0000ff;\">message<\/span>(__ADDINFO__(<strong><span style=\"color: #339966;\">msg<\/span><\/strong>)))\r\n\r\n#endif \/\/ <span style=\"color: #999999;\">_COMPILEWARNINGS_H_\r\n<\/span><\/code><\/pre>\n<pre><code><span style=\"color: #333399;\"><strong>CWARNING<\/strong><\/span>(<span style=\"color: #993366;\">\"This is just a warning\"<\/span>);\r\n<span style=\"color: #333399;\"><strong>CERROR<\/strong><\/span>(<span style=\"color: #993366;\">\"If you get this error, call for help and hide under your desk!!\"<\/span>);\r\n<\/code><\/pre>\n<pre><span style=\"color: #999999;\"><a href=\"https:\/\/www.myopictopics.com\/wp-content\/uploads\/2011\/04\/ErrorList.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-136\" title=\"ErrorList\" alt=\"\" src=\"https:\/\/www.myopictopics.com\/wp-content\/uploads\/2011\/04\/ErrorList.png\" width=\"671\" height=\"260\" srcset=\"https:\/\/www.myopictopics.com\/wp-content\/uploads\/2011\/04\/ErrorList.png 671w, https:\/\/www.myopictopics.com\/wp-content\/uploads\/2011\/04\/ErrorList-300x116.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/a><\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had this kicking around on my hard drive, so I thought I &#8216;d throw it out there. It&#8217;s not\u00a0exactly a big secret, but it certainly amused me when I\u00a0wrote it. Use CWARNING and CERROR to add compile-time items to the Error List window in Visual Studio. This is Visual Studio specific, but can be <a href='https:\/\/www.myopictopics.com\/?p=117' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,8],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-quickie","category-visual-studio","category-6-id","category-8-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":36,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":527,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions\/527"}],"wp:attachment":[{"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myopictopics.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}