views:

605

answers:

6

My colleagues and I have tried to build a project containing several thousand classes , but we're getting a LNK1102 error ( Linker out of memory ) . I've seen several tips on the internet , such as increasing the virtual memory . We tried but this didn't help . We've also seen some as enabling different warning levels when compiling the code . A guy suggested enabling level 4 for warnings . How could that be done ? Are there other suggestions ?

+1  A: 

If the project is too large, then split it up into several components.

This might also help with maintenance.

HS
We're preferring to keep that as a last option.
Vhaerun
Understandable. It needs some time and work.
HS
+1  A: 

If you are running this on a windows machine, open up task manager while linking and go to the performance page. If you see the page file usage increasing until its full, then increase the size of it to at least double your ram. If the page file is not filling up before it throws the error, then ensure there is enough disk space on the machine.

A: 

Run the 64 bits version of the Linker? Downside: you'll get a amd64 executable. (Unlike the 32->64 crosscompilation toolset, there is no 64->32 bit toolset)

MSalters
A: 

Definitely monitor the actual memory usage through task manager while linking. Close other programs to increase your available physical memory and set your page file to 4092 mb in size, if possible.

Also, it might help to create a link repro. This will allow other people to try to reproduce your link issues on other machines.

Wedge
A: 

I suspect that the linker also takes a lot of time to finish. Since you are saying there are thousands of c++ classes, my first thought was to check if there are many inlined class methods.

Try this:

Pick a bunch of classes that are used the most, make all inlined methods non-inline by moving them from the header file to the implementation file. I've experienced drastic changes in linking time. One project we had went from 15 minutes of pure linking to just 30 seconds. This should also affect the memory of the linking process.

Good luck! //Magnus

Magnus Skog
A: 

Project (right click) -> Properties -> Configuration Properties -> Linker -> Optimization -> References -> change to Keep Unreferenced Data

Worked on my machine!

Peter Goras