Hello!
I'm trying to compile a PHP extension in VS2008. It is dependent on 3 other projects which I link statically. It used to work fine when I had all my code in one .cpp file. I separated the code into several files to make it more manageable and now it won't compile.
I'm getting several (~100 per file) linker errors, LNK2005 (already defined). All of them are runtime library related I think.
So far I've tried
- Clean rebuild.
- Made sure the /MTd flag is the same on all 4 projects.
- Made sure that all headers are guarded.
Any ideas?
EDIT: Here are some of the errors: Some errors:
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