LNK1106 with big binary resource

2019-04-29 17:44发布

问题:

I have a rather huge .dat-file (896MB) included as a BIN resource in my project. Now I get a LNK1106 link error ("fatal error LNK1106: invalid file or disk full: cannot seek to 0x382A3920".) I use Visual Studio 2005 under Windows XP, and have tried on a 4GB RAM machine with high Virtual Memory settings and lots of disk space. I have tried a number of different optimization flags, but to no avail.

Does anyone have a clue?

EDIT: I have narrowed it down to a specific size of the compiled resource. If the .res file is 544078588 bytes (about 518.9MB) or larger, the error occurs. If it is smaller it works just fine. Still no solution, though...

回答1:

Under "Additional Linker Options", add /expectedoutputsize:600000000, and the link will work like a charm. You can't go too far with that switch though, or you'll end up with:

FATAL : link error LNK1102: out of memory



回答2:

I fixed this by changing /OPT:IFC to /OPT:NOIFC. Can't tell you why it works. Your results may vary.



回答3:

Is the dat file generated or has it changed recently? Your program may be trying to link against an incorrect version.