{"id":105,"date":"2015-04-29T18:28:29","date_gmt":"2015-04-29T18:28:29","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=105"},"modified":"2015-07-19T08:33:29","modified_gmt":"2015-07-19T15:33:29","slug":"android-vs-android-intellisense","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/android\/vs-android\/intellisense\/","title":{"rendered":"Configuring IntelliSense for vs-android"},"content":{"rendered":"<p>This tutorial shows how to configure IntelliSense for vs-android to automatically parse include files from the Android NDK and support all involved GNU extensions.<\/p>\n<ol>\n<li>Install <a href=\"\/download\"> VisualGDB<\/a> 5.0 or later (ensure that &#8220;Android Edition&#8221; is checked in the installer). This will add support for debugging and Clang-based IntelliSense to vs-android projects.<\/li>\n<li>Start Visual Studio. Select &#8220;Android-&gt;Setup SDK\/NDK Locations&#8221;. Specify the paths to your Android tools and click &#8220;Add Support&#8221; to select VisualGDB as a default debugger for vs-android projects:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/01-locations.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/01-locations.png\" alt=\"01-locations\" width=\"640\" height=\"293\" \/><\/a><\/li>\n<li>Open a vs-android project (in this example we will use the san-angeles demo) and ensure you can build it successfully:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/02-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/02-build.png\" alt=\"02-build\" width=\"699\" height=\"614\" \/><\/a><\/li>\n<li>Open one of the source files. Although the syntax highlighting and IntelliSense will work, you will most likely see some error messages:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/03-errors.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/03-errors.png\" alt=\"03-errors\" width=\"699\" height=\"613\" \/><\/a><\/li>\n<li>This happens because the NDK uses some GNU extensions that are not enabled with Clang by default. As of NDK r10, the following extensions are used:<br \/>\n<table class=\"neat_table\" style=\"width: 100%;\">\n<tbody>\n<tr>\n<th>Extension<\/th>\n<th>Example<\/th>\n<th>Option to enable<\/th>\n<\/tr>\n<tr>\n<td>Named variadic macros<\/td>\n<td>#define __builtin_warning(x, y&#8230;)<\/td>\n<td>-Wno-variadic-macros<\/td>\n<\/tr>\n<tr>\n<td>Zero-length arrays<\/td>\n<td>char _pad[0]<\/td>\n<td>-Wno-zero-length-array<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Furthermore, the san-angeles example uses some C functions without declaring them and this will be treated as an error unless <strong>-Wno-implicit-function-declaration<\/strong> is specified.<\/p>\n<p>To enable those extensions, double-click on the errors in Error List and, then select the smart tag in the code at the error location and select &#8220;ignore this issue for the project&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/03a-tag.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/03a-tag.png\" alt=\"03a-tag\" width=\"699\" height=\"614\" \/><\/a><\/li>\n<li>Once you have enabled all relevant extensions, you can get an overview of the added IntelliSense flags by right-clicking on your project in Solution Explorer, selecting VisualGDB Project Properties, going to the IntelliSense Settings page and checking the &#8220;Additional flags for C files&#8221; field:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/04-properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/04-properties.png\" alt=\"04-properties\" width=\"704\" height=\"630\" \/><\/a><\/li>\n<li>Press OK to apply the new settings. The error messages will now disappear and the IntelliSense engine will be able to parse the code correctly. Right-click on appRender() and select &#8220;Find all references&#8221; to test it out. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/05-refs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/05-refs.png\" alt=\"05-refs\" width=\"699\" height=\"612\" \/><\/a>Note that clang-powered &#8220;Find All References&#8221; command will also look into references within preprocessor macro expansions and will work instantly even for huge projects.<\/li>\n<li>You can also quickly explore the structure of the source code by right-clicking on a function and selecting &#8220;Explore call hierarchy&#8221;. You can then choose to browse called functions, calling functions, or both:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/06-calls.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/06-calls.png\" alt=\"06-calls\" width=\"699\" height=\"612\" \/><\/a><\/li>\n<li>Start debugging your app by pressing F5 (given that you have enabled debugger integration as described in the beginning of this tutorial). Set a breakpoint in camTrack(). Once it is triggered, try entering a complex expression (e.g. cam-&gt;dest) in the Watch window. The auto-completion work there same way as when debugging C# programs:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/07-sense.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/07-sense.png\" alt=\"07-sense\" width=\"699\" height=\"614\" \/><\/a><\/li>\n<li>You can also use preprocessor macros in Watch expressions or hover mouse over them to see their value in the current context:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/08-macro.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/intellisense\/08-macro.png\" alt=\"08-macro\" width=\"699\" height=\"611\" \/><\/a><\/li>\n<li>When you are done debugging, press Shift-F5 to end the debugging session.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to configure IntelliSense for vs-android to automatically parse include files from the Android NDK and support<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[31,52,48],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/105"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":181,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/105\/revisions\/181"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}