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 ?
If the project is too large, then split it up into several components.
This might also help with maintenance.
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.
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)
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.
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
Project (right click) -> Properties -> Configuration Properties -> Linker -> Optimization -> References -> change to Keep Unreferenced Data
Worked on my machine!