How linker solves ambiguities when linking *.libs?

后端 未结 1 1071
醉酒成梦
醉酒成梦 2021-01-28 00:02

after very long long time spent with unresolved externals I found that VS2010 was linking wrong .lib file.

Files were unfortunately named with same name.

Folder

1条回答
  •  广开言路
    2021-01-28 00:35

    Think of LIBs to Linker as header to compiler. A LIB only has signature of exported symbols, unless it is static LIB. LIB files do not have any version attached to them.

    Two LIB file can have same name, as two header files can have. It's you, the programmer, who has to use correct LIB/header file. If the linker doesn't find all symbols, or if symbols are not correct, it will report error (just like compiler will do for inconsistent symbols in header file).

    0 讨论(0)
提交回复
热议问题