error LNK2005: _DllMain@12 already defined in MSVCRT.lib

前端 未结 17 2040
臣服心动
臣服心动 2020-12-14 06:44

I am getting this linker error.

mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)

17条回答
  •  温柔的废话
    2020-12-14 07:07

    If you read the linker error thoroughly, and apply some knowledge, you may get there yourself:

    The linker links a number of compiled objects and libraries together to get a binary.

    Each object/library describes

    • what symbols it expects to be present in other objects
    • what symbols it defines

    If two objects define the same symbol, you get exactly this linker error. In your case, both mfcs80.lib and MSVCRT.lib define the _DllMain@12 symbol.

    Getting rid of the error:

    1. find out which of both libraries you actually need
    2. find out how to tell the linker not to use the other one (using e.g. the tip from James Hopkin)

提交回复
热议问题