{"id":33089,"date":"2023-11-14T19:13:43","date_gmt":"2023-11-14T19:13:43","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=33089"},"modified":"2023-11-14T19:12:13","modified_gmt":"2023-11-14T19:12:13","slug":"unreal-engine-cpp-game-development-made-easy-visual-studio-2022","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/unreal-engine-cpp-game-development-made-easy-visual-studio-2022\/","title":{"rendered":"Unreal Engine and C++ Game Development Made Easy with Visual Studio 2022"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33093\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920.jpg\" alt=\"A Sea of Thieves character on a boat. There are Sea of Thieves, Unreal Engine and Visual Studio logos.\" width=\"1920\" height=\"1080\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920.jpg 1920w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920-300x169.jpg 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920-1024x576.jpg 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920-768x432.jpg 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ueannouncement4_1920-1536x864.jpg 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Creating amazing games just got easier. We are very happy to announce the latest Unreal Engine integrations and powerful C++ productivity features in Visual Studio 2022. Our team has been tirelessly working to incorporate your feedback and bring even more features that will enhance your game development experience whether you work on Unreal Engine or a proprietary engine.<\/p>\n<p>In this blog, we will explore how you can leverage the new <strong>Unreal Engine Test Adapter, <\/strong>which helps to streamline your testing process without leaving the IDE. Then, we will also show you how you can code faster with Unreal Engine <strong>snippets<\/strong> and <strong>macro specifier suggestions<\/strong>, as well as <strong>view in-memory bitmaps<\/strong>. Next, we have included a range of core C++ productivity features and debugger enhancements that will benefit not only those working on Unreal Engine but also anyone who works on their own engines. Lastly, we will round out the blog with updates on C++ IntelliSense and debugger launch performance improvements.<\/p>\n<p>Most of these productivity features are available in Visual Studio 2022 version 17.8, while some are available in the latest previews. We are confident that these features will help you be more productive and enable you to create even more amazing games.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\" target=\"_blank\">Download Visual Studio 2022 17.8<\/a><\/div><\/p>\n<h2>Latest Unreal Engine Integrations<\/h2>\n<h3>Setting Up Unreal Engine Integrations<\/h3>\n<p>Unreal Engine integrations will only show up when you are working on an Unreal Engine project. To ensure these features are active, double check that the \u201cIDE support for Unreal Engine\u201d component is enabled in the \u201cGame development for C++\u201d workload in the Visual Studio Installer. Some integrations such as Blueprints support and Test Adapter will require the free &#8220;Visual Studio Integration Tool&#8221; Unreal Engine Plugin. Please see <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/gamedev\/unreal\/get-started\/vs-tools-unreal-overview\">Visual Studio Tools for Unreal Engine<\/a> for detailed setup instructions.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-31747\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent.png\" alt=\"The screenshot of the Game development with C++ workload in the Visual Studio Installer with &quot;IDE support for Unreal Engine&quot; checked.\" width=\"618\" height=\"629\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent.png 618w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent-295x300.png 295w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent-24x24.png 24w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/02\/uecomponent-48x48.png 48w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/a><\/p>\n<h3>Unreal Engine Test Adapter<\/h3>\n<p><em>Special thanks to the folks at Rare who contributed tremendously to this feature.<\/em><\/p>\n<p>Streamline your testing process without leaving the IDE with <strong>Unreal Engine Test Adapter<\/strong>. You can now discover, run, manage, and debug your Unreal Engine tests. In Visual Studio 2022 version 17.8, you will automatically see your Unreal Engine Tests when you open Visual Studio. To see your tests, you can open Test Explorer with View &gt; Test Explorer.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_example.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33094\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_example.png\" alt=\"A screenshot of the Test Explorer window in Visual Studio loaded with Unreal Engine tests\" width=\"1008\" height=\"567\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_example.png 1008w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_example-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_example-768x432.png 768w\" sizes=\"(max-width: 1008px) 100vw, 1008px\" \/><\/a><\/p>\n<p>The latest version of our free <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/gamedev\/unreal\/get-started\/vs-tools-unreal-overview\">Visual Studio Tools for Unreal Engine<\/a> plugin is required to use Unreal Engine Test Adapter. In addition, ensure the \u201cUnreal Engine Test Adapter\u201d component in the \u201cGame development with C++\u201d workload is enabled in the Visual Studio Installer.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_component.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33095\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_component.png\" alt=\"A screenshot of the Visual Studio Installer. Unreal Engine Test Adapter under Game development with C++ is circled.\" width=\"315\" height=\"580\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_component.png 315w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/tafue_component-163x300.png 163w\" sizes=\"(max-width: 315px) 100vw, 315px\" \/><\/a><\/p>\n<h3>Unreal Engine Code Snippets<\/h3>\n<p>Write code more efficiently with <strong>Unreal Engine Code Snippets<\/strong>. In Visual Studio 2022 version 17.8, you can find common Unreal Engine constructs as snippets in your member list. To begin, enter the name of any Unreal Engine construct, such as &#8220;uclass&#8221;. Then, press Tab or Enter to expand the snippet.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uesnippets.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33096\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uesnippets.png\" alt=\"A screenshot of a UCLASS Unreal Engine snippet in Visual Studio\" width=\"1000\" height=\"563\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uesnippets.png 1000w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uesnippets-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uesnippets-768x432.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>We have also included exported versions of <code>UCLASS<\/code> (uclass, uclassexported), <code>UINTERFACE<\/code> (uinterface, uinterfaceexported), and <code>USTRUCT<\/code> (ustruct, ustructexported) for those working with exported APIs and plugins. In addition, we have included macros such as <code>SWidget<\/code> (swidget), <code>TActorRange<\/code> (tactorrange), <code>TObjectRange<\/code> (tobjectrage), and <code>WITH_EDITOR<\/code> (witheditor) based on your feedback.<\/p>\n<p>List of Supported Snippets<\/p>\n<pre class=\"prettyprint language-cpp\"><code class=\"language-cpp\">uclass\r\nuclassexported\r\nuenum\r\nufunction\r\nuinterface\r\nuinterfaceexported\r\nuproperty\r\nustruct\r\nustructexported\r\nuelog\r\nswidget\r\ntactoreange\r\ntobjectrange\r\nwitheditor<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3>Image Watch Support for Unreal Engine Projects<\/h3>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchEx.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33099\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchEx.png\" alt=\"A screenshot of the image watch extension showing an in-memory bitmap\" width=\"664\" height=\"627\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchEx.png 664w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchEx-300x283.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchEx-24x24.png 24w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>We are excited to announce that <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=VisualCPPTeam.ImageWatchForVisualStudio2022\">Image Watch for Visual Studio 2022<\/a> now supports Unreal Engine&#8217;s <code>FImage<\/code> type. Image Watch is an <em>extension<\/em> that makes it easier than ever for you to view in-memory bitmaps while debugging C++ code. This is an essential tool for anyone working with images in C++. Be sure to try out the extension today.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchUEShort.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33100\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ImageWatchUEShort.gif\" alt=\"A Gif showcasing Image Watch with Unreal Engine Projects\" width=\"1220\" height=\"722\" \/><\/a><\/p>\n<h3>Unreal Engine Macro Specifier IntelliSense<\/h3>\n<p><em>In the coming weeks, Unreal Engine developers will gradually gain access to this experimental feature in the Visual Studio 2022 version 17.8.<\/em><\/p>\n<p>One of the top feedback items we commonly receive is suggesting Unreal Engine macro specifiers. We are happy to share that macro specifiers will start appearing in your member list suggestions for reflection macros in Visual Studio 2022 version 17.8. You can now quickly access all possible specifiers for respective macros without relying on memory or switching back and forth between Visual Studio and documentation.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33098\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel.png\" alt=\"A screenshot of Visual Studio's member list suggestion Unreal Engine Macro specifiers\" width=\"1367\" height=\"768\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel.png 1367w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel-1024x575.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/uemacrointel-768x431.png 768w\" sizes=\"(max-width: 1367px) 100vw, 1367px\" \/><\/a><\/p>\n<h3>Improved Blueprint Experience in Visual Studio<\/h3>\n<p><em>In the coming weeks, Unreal Engine developers will gradually gain access to this experimental feature in the Visual Studio 2022 version 17.9 Preview channels.<\/em><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33160\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2.png\" alt=\"a screenshot of blueprint references showing as codelens hints in visual studio\" width=\"1098\" height=\"366\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2.png 1098w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2-300x100.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2-1024x341.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/blueprintsv2-768x256.png 768w\" sizes=\"(max-width: 1098px) 100vw, 1098px\" \/><\/a><\/p>\n<p>Blueprints support in Visual Studio just got easier. You can now view Blueprint references and Asset Properties <em>without<\/em> installing the Visual Studio Integration Tool plugin. The update removes the requirement for building your game before gathering Blueprint information. You will notice a significant enhancement in the way Blueprint references are handled. Visual Studio will now display CodeLens hints with less machine resources and reduced latency. Next, we have added support for including usages of UFUNCTIONs outside of the class hierarchy directly in the CodeLens results. Lastly, we will cache the results from previous scans and only process new or modified assets since the last scan.<\/p>\n<h3>Improved IntelliSense for Unreal Engine Projects<\/h3>\n<p>Unreal Engine uses its own reflection mechanism to connect its C++ and Blueprints worlds. This is achieved through custom preprocessing of C++ sources with Unreal Header Tool (UHT) and injection through the regular C++ preprocessor. In Visual Studio 2022 version 17.9 Preview 1, we have improved the handling of Unreal Engine IntelliSense by ensuring consistency and accuracy. IntelliSense in Visual Studio will now refresh more readily for UHT generated files, reducing the likelihood of displaying unwarranted errors.<\/p>\n<h3>Unreal Engine Macro Indentation Rules<\/h3>\n<p>In Visual Studio 2022 version 17.7, we\u2019ve introduced <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/partnering-with-the-coalition\/#special-macro-indentation-rules-for-unreal-engine\">special indentation rules<\/a> for reflection macros and slate declarative syntax. We&#8217;re always looking for ways to improve, and we&#8217;ve been thrilled to hear positive feedback from the community. <strong>We would love to hear your thoughts on any additional Unreal Engine macros that you think should be considered.<\/strong> Please share your thoughts in the comments below or on X <a href=\"https:\/\/twitter.com\/visualc\">@VisualC<\/a>.<\/p>\n<h2>Core C++ Productivity Features<\/h2>\n<p>Thanks to the amazing and positive feedback from AAA game developers, we have created many core C++ productivity features that will benefit all C++ developers.<\/p>\n<h3>Build Insights Functions View<\/h3>\n<p>Build Insights is now integrated with Visual Studio 2022 and works with MSBuild and CMake projects. Backed by MSVC&#8217;s trace capture technology, you can now see additional information relating to function generation in Visual Studio 2022 version 17.8. The new <strong>Functions View<\/strong> will provide you with how long a function takes during compilation as well as the number of ForceInlines associated.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/buildinsightsmenu.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33101\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/buildinsightsmenu.png\" alt=\"A screenshot showing the Build Menu in Visual Studio with Run Build Insights on Solution selected\" width=\"947\" height=\"736\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/buildinsightsmenu.png 947w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/buildinsightsmenu-300x233.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/buildinsightsmenu-768x597.png 768w\" sizes=\"(max-width: 947px) 100vw, 947px\" \/><\/a><\/p>\n<p>Start your Build Insights .etl trace capture by going to the Build Menu.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33102\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions.png\" alt=\"A screen shot of build insights functions view\" width=\"2488\" height=\"1292\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions.png 2488w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions-300x156.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions-1024x532.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions-768x399.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions-1536x798.png 1536w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p1_build_insights_functions-2048x1064.png 2048w\" sizes=\"(max-width: 2488px) 100vw, 2488px\" \/><\/a><\/p>\n<p>After compilation, Build Insights will create a diagnostic report that shows you function generation time and number of ForceInlines.<\/p>\n<h3><code>const<\/code> and <code>static<\/code> Suggestions<\/h3>\n<p>New to Code Analysis in Visual Studio 2022 version 17.8, you will now see Visual Studio show suggestions to make member functions const and global functions static. You will increase your code&#8217;s consistency, readability, and security with the addition of these two features. For detailed information, please see <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/make-member-function-const-and-global-function-static-in-visual-studio\/\">Make Member Function const and Global Function static in Visual Studio<\/a>.<\/p>\n<h4>Make Member Functions <code>const<\/code><\/h4>\n<p>Visual Studio will identify cases where a member function can be made const. This can provide additional guarantees to the caller of the function and can also enable certain optimizations by the compiler. The linter suggestion will only be offered if the member function does not mutate the state of the object.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-function-const-in-multi-file.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-32800\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-function-const-in-multi-file.gif\" alt=\"Make function const in multi file GIF\" width=\"2394\" height=\"1302\" \/><\/a><\/p>\n<p>The feature will suggest a member function can be made const by displaying three dots below the function. A message will appear when you hover over the dots, informing you that the member function can be made const. You can then click on the light bulb to make the member function const. The changes will apply to all files that have the selected member function.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-32794\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting.png\" alt=\"Make Member Function Const Setting\" width=\"1801\" height=\"1322\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting.png 1801w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting-300x220.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting-1024x752.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting-768x564.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Member-Function-Can-be-Made-Const-Setting-1536x1127.png 1536w\" sizes=\"(max-width: 1801px) 100vw, 1801px\" \/><\/a><\/p>\n<p>This feature is on-by-default. You can customize the severity of these suggestions by going to Tools &gt; Options &gt; Text Editor &gt; C\/C++ &gt; Code Style &gt; Linter.<\/p>\n<h4>Make Global Functions <code>static<\/code><\/h4>\n<p>You will now see hints in Visual Studio when global functions can be marked as static. Static functions have linkage limited to one translation unit, which can help improve performance by allowing the compiler to perform certain optimizations. As a bonus, this will also prevent naming conflicts due to internal linkage. The feature works well with modern C++ projects and will not make suggestions for functions within anonymous namespaces. Static global functions are accessible within the translation unit where they are defined.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/make_-function_static.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-32795\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/make_-function_static.gif\" alt=\"Image make function static\" width=\"2146\" height=\"645\" \/><\/a><\/p>\n<p>You will see a suggestion appear with a screwdriver icon for global functions without a forward declaration. This suggestion will indicate that you can make the function static. You can make the function static by clicking the screwdriver icon and selecting &#8220;Make this function static\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-global-function-static-setting.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-32796\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-global-function-static-setting.png\" alt=\"Make global function static setting.\" width=\"737\" height=\"660\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-global-function-static-setting.png 737w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/09\/Make-global-function-static-setting-300x269.png 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><\/p>\n<p>You can also customize this feature by changing the setting in Tools &gt; Options &gt; Text Editor &gt; C\/C++ &gt; IntelliSense.<\/p>\n<h3>Size and Alignment Information<\/h3>\n<h4>Viewing Size and Alignment in Quick Info<\/h4>\n<p>In Visual Studio 2022 version 17.8, you can easily see the size and alignment of any class, struct, union, base type, or enum in C++ by simply hovering over its name. No more scrolling or searching for declarations. Just hover and get the information you need in a glance. This feature will help you write more efficient and robust code in C++.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33103\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment.png\" alt=\"a screenshot of quick info on a Unreal Engine class showing size aend alignment information\" width=\"1303\" height=\"416\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment.png 1303w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment-300x96.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment-1024x327.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/ue_size_alignment-768x245.png 768w\" sizes=\"(max-width: 1303px) 100vw, 1303px\" \/><\/a><\/p>\n<p>This feature is on-by-default. To access the settings, go to Tools &gt; Options &gt; Text Editor &gt; C\/C++ &gt; IntelliSense.<\/p>\n<h3><code>#include<\/code> Directives<\/h3>\n<h4><code>#include<\/code> Cleanup<\/h4>\n<p>Thanks to your feedback, you can now use #include cleanup to remove unused headers, add direct headers, and help you maintain clean code. To maximize the use of #include cleanup, we recommend first using the direct include suggestions, then the unused include suggestions.<\/p>\n<p><figure id=\"attachment_32557\" aria-labelledby=\"figcaption_attachment_32557\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/07\/remove_unused_includes.gif\"><img decoding=\"async\" class=\"size-full wp-image-32557\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/07\/remove_unused_includes.gif\" alt=\"Gif showing remove unused includes.\" width=\"1266\" height=\"633\" \/><\/a><figcaption id=\"figcaption_attachment_32557\" class=\"wp-caption-text\">Gif showing remove unused includes.<\/figcaption><\/figure><\/p>\n<p>#include cleanup is off-by-default. You can enable it by navigating to Tools &gt; Options &gt; Text Editor &gt; C\/C++ &gt; IntelliSense and selecting \u201cEnable #include cleanup.\u201d Once enabled, you have the flexibility to adjust the settings and configure different levels to meet your specific needs and preferences.<\/p>\n<p>For detailed information on how to fully utilize the new #include clean up tool, please see <a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/ide\/include-cleanup-overview?view=msvc-170\">Clean up C\/C++ #includes in Visual Studio<\/a>.<\/p>\n<h4>Sort <code>#include<\/code><\/h4>\n<p>In Visual Studio 2022 version 17.8, we have made it easier for you to organize your #include directives in C++ according to your preferences.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p3_sort_include_cleanup.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33121\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/17.8p3_sort_include_cleanup.gif\" alt=\"A gif showing configuring sort includes then actually sorting the includes\" width=\"1276\" height=\"756\" \/><\/a><\/p>\n<p>You can sort them with a simple right-click on any #include statement and choose the \u201cSort #include directives\u201d option. In addition, you can also sort them automatically with the Code Cleanup feature, which you can configure by adding \u201cSort #include directives (C++)\u201d to the Included fixers section. Sorting your #include directives will help you manage your dependencies, avoid duplication, and improve your code quality.<\/p>\n<p><span class=\"TextRun SCXW118715893 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW118715893 BCX8\" data-ccp-charstyle=\"normaltextrun\" data-ccp-charstyle-defn=\"{&quot;ObjectId&quot;:&quot;85aac190-e627-41c2-a102-e6623b5f8744|218&quot;,&quot;ClassId&quot;:1073872969,&quot;Properties&quot;:[469775450,&quot;normaltextrun&quot;,201340122,&quot;1&quot;,469778129,&quot;normaltextrun&quot;,335572020,&quot;1&quot;,134234072,&quot;true&quot;,134234073,&quot;true&quot;,134234074,&quot;true&quot;,134233614,&quot;true&quot;,469778324,&quot;Default Paragraph Font&quot;]}\">You can configure include cleanup and <\/span><span class=\"FindHit SCXW118715893 BCX8\" data-ccp-charstyle=\"normaltextrun\">sort<\/span><span class=\"NormalTextRun SCXW118715893 BCX8\" data-ccp-charstyle=\"normaltextrun\">ing at<\/span><span class=\"NormalTextRun SCXW118715893 BCX8\" data-ccp-charstyle=\"normaltextrun\"> Tools &gt; Options &gt; Text Editor &gt; C\/C++ &gt; Code Cleanup.<\/span><span class=\"NormalTextRun SCXW118715893 BCX8\" data-ccp-charstyle=\"eop\" data-ccp-charstyle-defn=\"{&quot;ObjectId&quot;:&quot;85aac190-e627-41c2-a102-e6623b5f8744|219&quot;,&quot;ClassId&quot;:1073872969,&quot;Properties&quot;:[469775450,&quot;eop&quot;,201340122,&quot;1&quot;,469778129,&quot;eop&quot;,335572020,&quot;1&quot;,134234072,&quot;true&quot;,134234073,&quot;true&quot;,134234074,&quot;true&quot;,134233614,&quot;true&quot;,469778324,&quot;Default Paragraph Font&quot;]}\">\u202f<\/span><\/span><span class=\"EOP SCXW118715893 BCX8\" data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<h4><code>#include<\/code> Diagnostic References<\/h4>\n<p>In Visual Studio 2022 version 17.9 Preview 1, you will be able to utilize #include diagnostic references to help you analyze how your #include directives are used in your C++ code. You will see the number and locations of references for each #include directive in your codebase.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/include_diagnostics_r-scaled.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33148\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/include_diagnostics_r-scaled.gif\" alt=\"Image include diagnostics r\" width=\"2500\" height=\"1008\" \/><\/a><\/p>\n<p>Click on the reference count to see a list of references and double-click on any reference to go to its location. This feature can greatly help you manage your dependencies and avoid duplication.<\/p>\n<h2>Visual Studio Performance and Debugger Improvements<\/h2>\n<h3>Improving Time to Colorization for Large C++ Projects<\/h3>\n<p>In Visual Studio version 17.8, our team has implemented significant enhancements to the performance of IntelliSense and colorization in C++ files for large projects. Specifically, we&#8217;ve improved the speed at which these features become available when opening a previously accessed (cached) file. To achieve this, we&#8217;ve restructured the loading of IntelliSense state into multiple phases, with a focus on prioritizing the most critical information. This includes colorization and highlighting selected references, which are now computed first. As a result of these optimizations, you will experience a faster and more efficient experience.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33107\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel.png\" alt=\"a graph showing time to intellisense bench marked on unreal engine 5.1. VS 17.8 =1.3s VS 17.7 =1.8s \" width=\"2116\" height=\"1406\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel.png 2116w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel-300x199.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel-1024x680.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel-768x510.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel-1536x1021.png 1536w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/timetointel-2048x1361.png 2048w\" sizes=\"(max-width: 2116px) 100vw, 2116px\" \/><\/a><\/p>\n<h3>Improved Debug Launch Speed for C++ Projects<\/h3>\n<p>In Visual Studio version 17.8, you will launch the debugger faster. We&#8217;ve substantially enhanced F5 performance for Windows applications by optimizing breakpoint setup. For example, this optimization delivers a remarkable 20% speed improvement for Unreal Editor projects. These improvements optimize file presence checks within modules, benefiting debugging C++ code with numerous breakpoints and files involved in the build process. Furthermore, we&#8217;ve streamlined the Windows PDB loading process, reducing the time required to load a PDB once it&#8217;s located.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33140\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp.png\" alt=\"graph showing faster debugger launch speed 24 secs in 17.7 and 19 secs in 17.8\" width=\"2240\" height=\"1293\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp.png 2240w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp-300x173.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp-1024x591.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp-768x443.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp-1536x887.png 1536w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/debuglaunchbp-2048x1182.png 2048w\" sizes=\"(max-width: 2240px) 100vw, 2240px\" \/><\/a><\/p>\n<h3>Instrumentation Tool: New &#8220;Start with collection paused&#8221; Option<\/h3>\n<p>In Visual Studio 2022 version 17.9 Preview 1, the Instrumentation Tool now includes a &#8220;Start with collection paused&#8221; option for profiling C++ applications. With this feature, you can start your game under the profiler&#8217;s control without immediately collecting data. This allows you to get into the game before data collection starts. Additionally, you can resume data collection later when needed by hitting the record button.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33104\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation.png\" alt=\"A screenshot of the Visual Studio profiler with a new option &quot;Start with collection paused&quot;\" width=\"1831\" height=\"751\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation.png 1831w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation-300x123.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation-1024x420.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation-768x315.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/11\/instrumentation-1536x630.png 1536w\" sizes=\"(max-width: 1831px) 100vw, 1831px\" \/><\/a><\/p>\n<h2>Feedback Wanted!<\/h2>\n<p>With the latest game developer productivity updates in Visual Studio 2022, we aim to empower game developers and enhance their productivity through innovative and powerful tools. This release is another step towards our vision of a streamlined game development process. Your feedback has been instrumental in shaping our development path. We strongly encourage you to continue to share your thoughts and ideas with us by reaching out through Developer Community, surveys, X (@VisualC), or email at visualcpp@microsoft.com. Thank you for your continued support. Together, we can drive game development to new heights with Visual Studio 2022.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Creating amazing games just got easier. We are very happy to announce the latest Unreal Engine integrations and powerful C++ productivity features in Visual Studio 2022. Our team has been tirelessly working to incorporate your feedback and bring even more features that will enhance your game development experience whether you work on Unreal Engine [&hellip;]<\/p>\n","protected":false},"author":39811,"featured_media":33093,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,1,3927],"tags":[140,3918,331,3901],"class_list":["post-33089","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-cplusplus","category-game-development","tag-c","tag-game-dev","tag-game-development","tag-unreal-engine"],"acf":[],"blog_post_summary":"<p>Introduction Creating amazing games just got easier. We are very happy to announce the latest Unreal Engine integrations and powerful C++ productivity features in Visual Studio 2022. Our team has been tirelessly working to incorporate your feedback and bring even more features that will enhance your game development experience whether you work on Unreal Engine [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/33089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/39811"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=33089"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/33089\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/33093"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=33089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=33089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=33089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}