VS2008 で PHP 拡張機能をコンパイルしようとしています。私が静的にリンクしている他の 3 つのプロジェクトに依存しています。すべてのコードが 1 つの .cpp ファイルにあるときは、問題なく動作していました。コードをいくつかのファイルに分けて管理しやすくしたところ、コンパイルできなくなりました。
いくつか (ファイルごとに ~ 100) のリンカ エラー、LNK2005 (定義済み) が発生します。それらはすべてランタイム ライブラリに関連していると思います。
これまで私は試しました
- きれいに再構築します。
- /MTd フラグが 4 つのプロジェクトすべてで同じであることを確認しました。
- すべてのヘッダーが保護されていることを確認しました。
何か案は?
編集:ここにいくつかのエラーがあります:いくつかのエラー:
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