Have Visual Studio 2013 or Greater Embed XML Tag to Use Native Build Tools
We recently came across a problem where the compiler was running out of heap space due to how Qt handles its resource files and generates a massive static array. We looked at changing over to using the dynamic approach but felt it was more risk averse to try and break the files down into smaller chunks. Well, this did not work out so well, due to the fact we would run into this problem again later when adding more resources.
I looked at a MSDN article on the compiler error. There were many suggestions and none of them worked. I found it funny that one of the suggestions that was mentioned was to switch over to using the x64 version of the compiler. That is great and all, but the IDE has never allowed for the developer to choose which compiled version of the compiler to use.
I ran across this article (https://stackoverflow.com/questions/19820718/how-to-make-visual-studio-use-the-native-amd64-toolchain) on how to setup the build environment to indicate which compiled version of the build tools to use. This worked great for us and the resource file compiled with not a problem.
On IDE VS2012, add the following to the environment: set _IsNativeEnvironment=true On IDE VS2013 or greater, add the following to the environment: set PreferredToolArchitecture=x64
I then saw a link (https://blogs.msdn.microsoft.com/vcblog/2013/10/29/the-visual-c-linker-best-practices-developer-iteration/) in the article that states how to set this option in the IDE such that the environment variable does not have to be defined. In the comment section, the author of the article describes what is needed to set the build tools to use the architecture of the OS. It is rather simple tag. It is only available for VS2013 or greater. All that is needed is shown below.
<PropertyGroup> <UseNativeEnvironment>true</UseNativeEnvironment> </PropertyGroup>
I am requesting that this tag be included into the generation Visual Studio project files for VS2013 and greater. I am not sure if this needs to be automatic or if it should be behind some kind of global / target switch. I personally think a global switch is fine, but I would leave that decision up to you.
Thanks for the consideration, Ryan Kawicki