I've been successfully developing several PHP extensions for data processing both on Windows and Linux. In addition to that, I have many OpenCV projects on both operating systems fully working.
Recently I've been trying to create a PHP extension for PHP 7.2 using the official SDK on Windows. I could easily compile it with nmake and it loaded without any problem. Then I compiled an OCR library of my own that uses OpenCV 3.2 and linked it to an exe and it worked too.
The I try linking the dll of the extension to both the PHP SDK library file and the library I made using OpenCV, but no matter what I try I always get these errors only when I link both libs to the dll:
1>my_ocr_lib.lib(my_ocr_lib.obj) : error LNK2005: "public: void __cdecl std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QEAAXXZ) already defined in php_my_ocr.obj 1>my_ocr_lib.lib(my_ocr_lib.obj) : error LNK2005: "public: void __cdecl std::_Container_base12::_Swap_all(struct std::_Container_base12 &)" (?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z) already defined in php_my_ocr.obj 1>my_ocr_lib.lib(my_ocr_lib.obj) : error LNK2005: "void * __cdecl std::_Allocate(unsigned __int64,unsigned __int64,bool)" (?_Allocate@std@@YAPEAX_K0_N@Z) already defined in php_my_ocr.obj 1>my_ocr_lib.lib(my_ocr_lib.obj) : error LNK2005: "void __cdecl std::_Deallocate(void *,unsigned __int64,unsigned __int64)" (?_Deallocate@std@@YAXPEAX_K1@Z) already defined in php_my_ocr.obj 1> Creating library C:/cpp/my_ocr/build/Debug/php_my_ocr.lib and object C:/cpp/my_ocr/build/Debug/php_my_ocr.exp 1>C:\cpp\my_ocr\build\Debug\php_my_ocr.dll : fatal error LNK1169: one or more multiply defined symbols found /MDd flag Any suggestions?