(为什么我想要做到这一点:我有没有运气中使用的预先建立的二进制文件libpng on Windows(尽管许多小时的审判和错误),因此我现在要编制它自己。我找到了 这个有帮助的博客 关于这一点,完全有Visual Studio2008项目文件,但不幸的是,仍未能使用它。)

它成功地编制时zlib二发现 在这里,, 但当尝试将其链接到一个测试文件,我收到以下:

    C:\Documents and Settings\Administrator\My Documents>cl "C:\Documents and Settin
    gs\Administrator\My Documents\test.c" "C:\Documents and Settings\Administrator\M
    y Documents\libpng.lib" -I "C:\Documents and Settings\Administrator\My Documents\include"

    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
    Copyright (C) Microsoft Corporation.  All rights reserved.

    test.c
    Microsoft (R) Incremental Linker Version 9.00.30729.01
    Copyright (C) Microsoft Corporation.  All rights reserved.

    /out:test.exe
    test.obj
    "C:\Documents and Settings\Administrator\My Documents\libpng.lib"
    MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _abort already defined in LIBCMT.lib(
    abort.obj)
    MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fread already defined in LIBCMT.lib(
    fread.obj)
    MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib
    (malloc.obj)
    MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMT.lib(f
    ree.obj)
    MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: ___iob_func already defined in LIBCMT
    .lib(_file.obj)
    LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
    se /NODEFAULTLIB:library
    test.exe : fatal error LNK1169: one or more multiply defined symbols found

任何人都可以照顾到一些阐明如何解决这些错误?

有帮助吗?

解决方案

问题是这两个项目是使用 多螺纹DLL 而其他使用 多螺纹 (没有DLL在这)在项目属性-->构的特性->C/C++->代码生成。

发生在我身上的好几倍。

确保"同步",设定即使释放的生成,并为每个可能的组合("调试",不"调试",等等)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top