I’m developing a Windows game that needs a lot of small different images, that I put in resources.qrc, they are in tot. 14 MB.
When I try to compile the only error is: «out of memory allocating 134 MB» «cc1plus.exe not found».
How can I handle this?
asked Sep 1, 2012 at 20:47
2
Windows 7SP1 x86 4 GB RAM
Qt 5.7.0
I had the same problem, when I added big file in resources in Qt. I had the error:
cc1plus.exe:-1: error: out of memory allocating 1073745919 bytes
Solution:
Add CONFIG += resources_big
into the *.pro
file.
I took it here: cc1plus.exe: out of memory | 60MB encrypted resource file
answered Aug 4, 2017 at 9:25
1
Don’t put them in the qrc, keep them as individual resources (or a new qrc file for each of the image), and just load them on application startup. Qt generates a qrc_XXXXX.cpp file where it effectively inserts the binary data in form of char array of ALL your resources in the resource fileXXXXX in this file (yes, ONE array for your images of 14MB, ie: 14680064 bytes (written as hex (0xXX) bytes into 1 file… it will be big!), highly possibly poor compiler just coughs on them…
answered Sep 1, 2012 at 21:22
Ferenc DeakFerenc Deak
34.1k17 gold badges99 silver badges166 bronze badges
Well, I had this problem too. But in my situation putting all resources into .exe
was necessary.
After this error I bought additional RAM (project is very important) and then my RAM became 12 GB (from 6 GB).
But I was very surprised when error hadn’t disappeared After some googling, finally, I found answer there. The problem is cc1plus.exe
executable memory limit. So, in case of Qt this problem can be solved in these steps (for Windows 7, MinGW32 4.9.2, for others probably simply needs to change paths):
- If your OS is 32 bit, then in cmd (as Admin) put
bcdedit /set IncreaseUserVa 3072
- Install masm32;
- Open cmd (as administrator too);
- Put
cd C:QtToolsmingw492_32libexecgcci686-w64-mingw324.9.2
- Put
C:masm32bineditbin.exe /LARGEADDRESSAWARE cc1plus.exe
That’s all.
answered Oct 14, 2016 at 11:52
RinatRinat
1,9412 gold badges16 silver badges26 bronze badges
1
Don’t forget the obvious either: The message might actually be true and you really don’t have enough memory, or the memory can’t be made available for the process that needs it.
I’ve got 16GB of RAM on my system which ought to be plenty for my small application. «It can’t possibly be that.» I thought… but my machine hadn’t been restarted in weeks.
A system restart is all it took to fix this error for me.
answered Sep 13, 2021 at 14:53
M_MM_M
1,9352 gold badges17 silver badges22 bronze badges
Загрузка…
I’m having a bit of an odd problem while trying to compile some code using the latest version of MinGW (GCC 4.5.2) under Windows Vista Home Premium 64-bit. While compiling this file, I get a message that «cc1plus.exe has stopped working» and the compilation fails with no error message. I have attempted to strip the file down to the absolute bare minimum that still produces the problem:
#include <boost/spirit/include/classic_file_iterator.hpp>
#include <boost/spirit/include/classic_position_iterator.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/spirit/include/qi.hpp>
#include <vector>
#define BOOST_SPIRIT_AUTO(domain_, name, expr)
typedef boost::proto::result_of::
deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type;
BOOST_SPIRIT_ASSERT_MATCH(
boost::spirit::domain_::domain, name##_expr_type);
BOOST_AUTO(name, boost::proto::deep_copy(expr));
using namespace std;
//This structure is used to determine the situation in which a certain tile sprite is used.
struct TileCase {
//A vector of bit fields for which adjacent tiles which must be filled.
vector<unsigned> filled;
//A vector of bit fields for which adjacent tiles are optionally filled.
vector<unsigned> optionalFilled;
TileCase() : filled(0),
optionalFilled(0){}
};
//Adapt the TileCase struct to a Fusion tuple.
BOOST_FUSION_ADAPT_STRUCT (
TileCase,
(std::vector<unsigned>, filled)
(std::vector<unsigned>, optionalFilled)
)
namespace qi = boost::spirit::qi;
namespace phoenix = boost::phoenix;
namespace ascii = boost::spirit::ascii;
using phoenix::function;
using ascii::space;
using ascii::char_;
using qi::eol;
//A skipper rule for comments.
BOOST_SPIRIT_AUTO(qi, comment, ("/*" >> *(char_ - "*/") >> "*/")
| ascii::space
| ("//" >> *(char_ - eol) >> eol)
);
//The Spirit error handler.
struct error_handler_ {
template<typename, typename, typename>
struct result { typedef void type; };
template <typename Iterator>
void operator()(
qi::info const& what,
Iterator err_pos, Iterator last) const
{
//Get the line position.
boost::spirit::classic::file_position_base<string> const& pos = err_pos.get_position();
//Throw an error.
stringstream error;
error << "Error! Expecting "
<< what
<< " at line "
<< pos.line
<< ", column "
<< pos.column
<< "!";
throw(runtime_error(error.str()));
}
};
function<error_handler_> const error_handler = error_handler_();
//The Spirit grammar for parsing tile data.
template<typename Iterator>
struct tileData : qi::grammar<Iterator, vector<TileCase>(), comment_expr_type> {
//The rule called when the parsing starts.
qi::rule<Iterator, vector<TileCase>(), comment_expr_type> start;
//The rule for parsing a single tile case.
qi::rule<Iterator, TileCase(), qi::locals<unsigned>, comment_expr_type> tile;
//The rule which parses yes/no/either bitflag blocks.
//Takes two references to unsigned, the first being the yes/no flag and the second being the optional flag.
qi::rule<Iterator, void(unsigned&, unsigned&), qi::locals<unsigned>, comment_expr_type> condBlock;
tileData() : tileData::base_type(start) {
using qi::eps;
using qi::lit;
using qi::on_error;
using qi::fail;
using qi::uint_;
using phoenix::at_c;
using phoenix::push_back;
using phoenix::resize;
using namespace qi::labels;
start = *tile[push_back(_val, _1)];
tile =
//Parse the filled definition.
lit("filled")
> '('
//Parse the generation to check for fills.
> uint_
[
_a = _1,
resize(at_c<0>(_val), _1 + 1),
resize(at_c<1>(_val), _1 + 1)
]
> ')'
//Opening curly bracket for filled definition.
> '{'
//The condition block.
> condBlock
(
//This one goes to filled[_a],
(at_c<0>(_val))[_a],
//and optionalFilled[_a].
(at_c<1>(_val))[_a]
)
//Closing curly bracket for filled definition.
> '}'
;
condBlock =
eps
[_a = 1]
>>
(
* (
(
+lit('+')
[_r1 += _a, _a *= 2]
)
|
(
+lit('*')
[_r2 += _a, _a *= 2]
)
|
(
+lit('-')
[_a *= 2]
)
)
)
;
on_error<fail>
(
start,
error_handler(_4, _3, _2)
);
}
};
int main() {
try {
//Set up the file iterator.
typedef char char_type;
typedef boost::spirit::classic::file_iterator<char_type> iterator_type;
//Open the file.
iterator_type first("Test.txt");
//Make sure the file is open.
if (!first) throw(runtime_error("Failed to open file!"));
//Find the end of the file.
iterator_type last = first.make_end();
//Wrap the file iterator with a position iterator.
typedef boost::spirit::classic::position_iterator2<iterator_type> pos_iterator_type;
typedef tileData<pos_iterator_type> tileData;
pos_iterator_type pos_first(first, last, "Test.txt");
pos_iterator_type pos_last;
//Prepare parsing information.
tileData tileData_parser;
vector<TileCase> cases;
//Parse the file.
if (phrase_parse(pos_first, pos_last, tileData_parser, comment, cases) && pos_first == pos_last) {
//Do something...
}
}
catch (const exception& e) {
cerr << "Exception while reading file:n" << e.what() << endl;
return 1;
}
return 0;
}
In this stripped-down version, the compiler only crashes if debugging symbols (-g) are enabled. However, with the full version of the file, it crashes regardless. As well, if a portion of the Spirit code is removed (such as the error handler, or the comment skipper), it also compiles correctly. This suggests to me that the compiler is running out of memory, but I’m not entirely sure how to fix it.
I have tried building directly from command-line as well as from within Code::Blocks, but cc1plus still crashes. The only compiler flag I have enabled is -g. I have double-checked that I only have one installation of MinGW, and I have tried re-installing it, but the problem persists. What would be causing this to happen?
So for future reference i’ve resolved the issue, i will post it here maybe others will need it. You need to have at least 4GB of ram!
If your OS is 32bit, then in cmd (as Admin) put bcdedit /set IncreaseUserVa 3072
Install masm32;
open cmd (as admin too);
put cd C:msys64mingw32libgcci686-w64-mingw32[VERSION]
put C:masm32bineditbin.exe /LARGEADDRESSAWARE cc1plus.exe
Be sure to find out which cc1plus.exe you are using, this is for mingw if you use QT add its own pat, usually
put cd C:QtToolsmingw492_32libexecgcci686-w64-mingw32[VERSION]
put C:masm32bineditbin.exe /LARGEADDRESSAWARE cc1plus.exe
That’s all. Hope it will be helpful:)
— Wed May 18, 2016 10:02 am
#47604
Hello,
I can’t compile, also only verify, any sketch if I select Generic esp8266 module,
I’ve tried the Bare minimum to be sure that works.
With Uno or other Arduino borads everything works, but selecting 8266 sais me:
Arduino:1.6.9 (Windows 7), Scheda:»Core Development Module, Espressif (xcc), 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None»
C:Program Files (x86)Arduinoarduino-builder -dump-prefs -logger=machine -hardware «C:Program Files (x86)Arduinohardware» -hardware «C:Usersm.mantovaniAppDataLocalArduino15packages» -tools «C:Program Files (x86)Arduinotools-builder» -tools «C:Program Files (x86)Arduinohardwaretoolsavr» -tools «C:Usersm.mantovaniAppDataLocalArduino15packages» -built-in-libraries «C:Program Files (x86)Arduinolibraries» -libraries «C:Usersm.mantovaniDocumentsArduinolibraries» -fqbn=esp8266:esp8266:coredev:LwIPVariant=Espressif,CpuFrequency=80,FlashFreq=40,FlashMode=dio,UploadSpeed=115200,FlashSize=512K64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10609 -build-path «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmp» -warnings=none -prefs=build.warn_data_percentage=75 -verbose «C:UsersMC5BB~1.MANAppDataLocalTempuntitled364995918.tmpsketch_may18asketch_may18a.ino»
C:Program Files (x86)Arduinoarduino-builder -compile -logger=machine -hardware «C:Program Files (x86)Arduinohardware» -hardware «C:Usersm.mantovaniAppDataLocalArduino15packages» -tools «C:Program Files (x86)Arduinotools-builder» -tools «C:Program Files (x86)Arduinohardwaretoolsavr» -tools «C:Usersm.mantovaniAppDataLocalArduino15packages» -built-in-libraries «C:Program Files (x86)Arduinolibraries» -libraries «C:Usersm.mantovaniDocumentsArduinolibraries» -fqbn=esp8266:esp8266:coredev:LwIPVariant=Espressif,CpuFrequency=80,FlashFreq=40,FlashMode=dio,UploadSpeed=115200,FlashSize=512K64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10609 -build-path «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmp» -warnings=none -prefs=build.warn_data_percentage=75 -verbose «C:UsersMC5BB~1.MANAppDataLocalTempuntitled364995918.tmpsketch_may18asketch_may18a.ino»
«C:Usersm.mantovaniAppDataLocalArduino15packagesesp8266toolsxtensa-lx106-elf-gcc1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++» -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/include» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/lwip/include» -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DARDUINO=10609 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0coresesp8266» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0variantsgeneric» «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmpsketchsketch_may18a.ino.cpp» -o «nul»
«C:Usersm.mantovaniAppDataLocalArduino15packagesesp8266toolsxtensa-lx106-elf-gcc1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++» -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/include» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/lwip/include» -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DARDUINO=10609 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0coresesp8266» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0variantsgeneric» «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmpsketchsketch_may18a.ino.cpp» -o «nul»
«C:Usersm.mantovaniAppDataLocalArduino15packagesesp8266toolsxtensa-lx106-elf-gcc1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++» -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/include» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0/tools/sdk/lwip/include» -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DARDUINO=10609 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0coresesp8266» «-IC:Usersm.mantovaniAppDataLocalArduino15packagesesp8266hardwareesp82662.2.0variantsgeneric» «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmpsketchsketch_may18a.ino.cpp» -o «C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmppreprocctags_target_for_gcc_minus_e.cpp»
cc1plus.exe: fatal error: opening output file C:UsersMC5BB~1.MANAppDataLocalTempbuilded46e1aee1271f7f958cd9e2af8ff61c.tmppreprocctags_target_for_gcc_minus_e.cpp: Permission denied
compilation terminated.
exit status 1
Errore durante la compilazione per la scheda Core Development Module.
Could it be some problem with User/Administrator permission?
I’m going crazy, i’ve re-installed everything 3 times, deleting all Arduino folders/libraries/AppData every time…
What’s the problem?
Thankyou guys