views:

423

answers:

4

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  A: 

The offset in binary is 898 MB. Hence, the linker is clearly seeking beyond the end of the file, by ~2MB. No idea why, but the message makes sense.

MSalters
A: 

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

Jesse
Well, it clear that it uses the correct file. When I substitute it for a smaller file, the linking is successful. Trying out smaller files now to see if I can find a magic size...
E Dominique
+1  A: 

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

Jeffrey Faust
Thanks for the input! It does not seem to make any difference for me, though... ;-\Here is my link command line: /VERBOSE:LIB /OUT:"NoDebug/MyProgram.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"MyLib_release\win\lib" /MANIFEST /MANIFESTFILE:"NoDebug\MyProgram.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:NOICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT MyLib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
E Dominique
+2  A: 

I have the solution for you.

Under "Additional Linker Options" add "/expectedoutputsize:600000000", and the link will work like a charm.

However, I am trying to include a 1024M resource, and I cannot solve it by increasing the expectedoutputsize, I only end up with this error:

FATAL : link error LNK1102: out of memory

I am on a 3G RAM machine with 4G of virtual memory. When I use procexp to monitor the resources, I have over 1G of RAM and 3G of virtual memory free. Still the linker thinks he is out of memory... I have tried VS2005 and VS2008, same problem.

Does anyone have a clue?

Mr Gladstone
Thanks! No clue for you, though. How about making a separate question on the matter, Mr.Gladstone?
E Dominique