2

我正在尝试在 VS2008 中编译 PHP 扩展。它依赖于我静态链接的 3 个其他项目。当我将所有代码都放在一个 .cpp 文件中时,它曾经可以正常工作。我将代码分成几个文件以使其更易于管理,现在它无法编译。

我收到几个(每个文件约 100 个)链接器错误,LNK2005(已定义)。我认为它们都是与运行时库相关的。

到目前为止我已经尝试过

  • 干净的重建。
  • 确保所有 4 个项目的 /MTd 标志都相同。
  • 确保所有标题都受到保护。

有任何想法吗?

编辑:这里有一些错误:一些错误:

MPQBlock.obj : error LNK2005: _getwchar already defined in MPQArchive.obj
MPQBlock.obj : error LNK2005: _putwchar already defined in MPQArchive.obj
MPQBlock.obj : error LNK2005: _acosl already defined in MPQArchive.obj
MPQBlock.obj : error LNK2005: _asinl already defined in MPQArchive.obj
etc.
MPQFile.obj : error LNK2005: _asinf already defined in MPQArchive.obj
MPQFile.obj : error LNK2005: _atanf already defined in MPQArchive.obj
MPQFile.obj : error LNK2005: _atan2f already defined in MPQArchive.obj
MPQFile.obj : error LNK2005: _ceilf already defined in MPQArchive.obj
MPQFile.obj : error LNK2005: _cosf already defined in MPQArchive.obj
etc.
PHPExtension.obj : error LNK2005: _acosl already defined in MPQArchive.obj
PHPExtension.obj : error LNK2005: _asinl already defined in MPQArchive.obj
PHPExtension.obj : error LNK2005: _atanl already defined in MPQArchive.obj
PHPExtension.obj : error LNK2005: _atan2l already defined in MPQArchive.obj
etc.
zlibd.lib(zutil.obj) : warning LNK4217: locally defined symbol _malloc imported in function _zcalloc
zlibd.lib(zutil.obj) : warning LNK4217: locally defined symbol _free imported in function _zcfree
D:\Server\PHP\ext\php_mpq_library.dll : fatal error LNK1169: one or more multiply defined symbols found
4

1 回答 1

0

更改可能有帮助的链接库的顺序...您可以发布一些错误...它会使图片更清晰...

  1. 单击设置。
  2. 单击以选择出现链接错误的项目配置。
  3. 在链接选项卡上,单击以选择类别组合框中的输入。
  4. 在忽略库框中,插入库名称(例如,Nafxcwd.lib;Libcmtd.lib)。

    注意 /NOD: 中的链接器命令行等效项。

  5. 在对象/库模块框中,插入库名称。您必须确保它们按顺序列出,并且作为该行中的前两个库(例如,Nafxcwd.lib Libcmtd.lib)。
于 2010-03-09T06:10:45.407 回答