在vs2019中进⾏qt桌⾯应⽤开发时,编译器堆溢出的编译错误
(errorC1060编译器。。。
⼀、错误现象
⼆、错误原因分析
1、此次错误出现的原因:当在qt资源⽂件中加⼊过多图⽚时(22Mb),编译⽂件内容过⼤导致
2、本质原因:vs2019中编译器默认是32位的,当参与编译的⽂件过⼤时,将会导致编译器堆溢出
三、应对⽅法
编译器错误1、若是在QtCreator中开发qt项⽬,因资源⽂件过⼤导致编译器堆溢出,那么可以在项⽬ .pro ⽂件中修改配置:CONFIG += resources_big
2、若是在Vs中进⾏项⽬开发时,编译提⽰编译器堆空间不⾜,那么可以打开项⽬的 .vcxproj ⽂件;到 <PropertyGroup Label="Globals">节点,并在该节点下添加 <PreferredToolArchitecture>x64</PreferredToolArchitecture>,将默认使⽤32位的编译器更换位64位,此时编译则问题解决
  添加前:
<PropertyGroup Label="Globals">
<ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
  添加后:
<PropertyGroup Label="Globals">
<ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>