J'essaye de compiler une extension PHP dans VS2008. Il dépend de 3 autres projets que je lie statiquement. Cela fonctionnait bien quand j'avais tout mon code dans un fichier .cpp. J'ai séparé le code en plusieurs fichiers pour le rendre plus gérable et maintenant il ne compilera pas.Pourquoi ai-je des erreurs LNK2005 lors de la compilation d'une extension PHP?
Je reçois plusieurs erreurs de lieur (~ 100 par fichier), LNK2005 (déjà défini). Tous sont liés à la bibliothèque d'exécution, je pense.
Jusqu'à présent, j'ai essayé
- propre reconstruction.
- Assurez-vous que le drapeau/MTd est le même sur les 4 projets.
- Assurez-vous que tous les en-têtes sont protégés.
Des idées?
EDIT: Voici quelques-unes des erreurs: Quelques erreurs:
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
Inclure '' avant d'inclure ''. Je pense que cela est dû au fait que PHP redéfinit "inline". –
Artefacto
Artefacto - Une solution simple qui a fonctionné. Merci! –