Linker Tools Warning LNK4072

section count count exceeds max (number); image may not run

The number of sections (a COFF .exe or .dll file is composed of sections, similar to segments) in the output file is greater than the limit that can be handled by the loader.

You can define your own sections using the data_seg, code_seg, and alloc_text pragmas. For example, the following program defines three sections called .a1, .a2, and .a3.

#pragma data_seg(".a1")
int a1 = 1;
#pragma data_seg(".a2")
int a2 = 2;
#pragma data_seg(".a3")
int a3 = 3;

int main() {
   ;
}

You can view the names of the sections in your executable file by using the DUMPBIN program with the default /SUMMARY option. See the DUMPBIN Reference for more information.

To reduce the number of sections in your executable file:

  • Remove unneeded data_seg, code_seg or alloc_text pragmas. See data_seg, code_seg, and alloc_text.

  • Use the /MERGE option with LINK to combine sections. See /MERGE.