Linker Tools Error LNK1179

invalid or corrupt file: duplicate comdat comdat

An object module contained two or more COMDATs with the same name.

One possible cause is if you use the /H option with /Gy. The /H option limits the length of external names, and the /Gy option packages functions in COMDATs.

For example, if you compile the following with /Gy and /H8, you will get error LNK1179 since the object module will contain two COMDATs of the same name (function1 and function2 are unique at nine characters):

void function1(void);
void function2(void);

void main(void) {
    function1();
    function2();
}

void function1(void) {}
void function2(void) {}