在 Windows 上编译我自己的 PHP 扩展,但出现 LNK 2005 错误

发布于 2024-08-16 04:33:48 字数 8715 浏览 8 评论 0原文

我正在使用 VC 2008 Express,并尝试用它编译我自己的 PHP 扩展。对以下错误有什么想法吗?

------ Rebuild All started: Project: xsplit, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'xsplit', configuration 'Debug|Win32'
Compiling...
xsplit.cpp
c:\x\php-5.3.1\zend\zend_execute.h(231) : warning C4018: '>' : signed/unsigned mismatch
.\xsplit.cpp(64) : warning C4091: 'typedef ' : ignored on left of '_dict' when no variable is declared
.\xsplit.cpp(154) : warning C4101: 'file_size' : unreferenced local variable
.\xsplit.cpp(153) : warning C4101: 'fd' : unreferenced local variable
.\xsplit.cpp(417) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(418) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(426) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(436) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(437) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(445) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(455) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(456) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(464) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(800) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(74) : see declaration of 'strcpy'
.\xsplit.cpp(932) : warning C4101: 'hashval' : unreferenced local variable
.\xsplit.cpp(931) : warning C4101: 'arrht' : unreferenced local variable
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation.  All rights reserved.
Linking...
Searching libraries
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Fputc<char>(char,struct _iobuf *)" (??$_Fputc@D@std@@YA_NDPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Ungetc<char>(char const &,struct _iobuf *)" (??$_Ungetc@D@std@@YA_NABDPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Fgetc<char>(char &,struct _iobuf *)" (??$_Fgetc@D@std@@YA_NAADPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
libcpmtd.lib(string.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "void __cdecl operator delete(void *,void *)" (??3@YAXPAX0@Z) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\LIBCMTD.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
Finished searching libraries
Searching libraries
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\LIBCMTD.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
Finished searching libraries
c:\xproject\xsplit\Debug\xsplit.dll : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\xproject\xsplit\xsplit\Debug\BuildLog.htm"
xsplit - 9 error(s), 16 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I am using VC 2008 express, and tried to compile my own PHP extension with that. Any idea about the following error?

------ Rebuild All started: Project: xsplit, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'xsplit', configuration 'Debug|Win32'
Compiling...
xsplit.cpp
c:\x\php-5.3.1\zend\zend_execute.h(231) : warning C4018: '>' : signed/unsigned mismatch
.\xsplit.cpp(64) : warning C4091: 'typedef ' : ignored on left of '_dict' when no variable is declared
.\xsplit.cpp(154) : warning C4101: 'file_size' : unreferenced local variable
.\xsplit.cpp(153) : warning C4101: 'fd' : unreferenced local variable
.\xsplit.cpp(417) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(418) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(426) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(436) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(437) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(445) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(455) : warning C4244: '=' : conversion from 'Darts::DoubleArrayBase<ValueType>::size_type' to 'float', possible loss of data
        with
        [
            ValueType=int
        ]
.\xsplit.cpp(456) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
.\xsplit.cpp(464) : warning C4244: '=' : conversion from 'size_t' to 'float', possible loss of data
.\xsplit.cpp(800) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(74) : see declaration of 'strcpy'
.\xsplit.cpp(932) : warning C4101: 'hashval' : unreferenced local variable
.\xsplit.cpp(931) : warning C4101: 'arrht' : unreferenced local variable
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation.  All rights reserved.
Linking...
Searching libraries
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Fputc<char>(char,struct _iobuf *)" (??$_Fputc@D@std@@YA_NDPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Ungetc<char>(char const &,struct _iobuf *)" (??$_Ungetc@D@std@@YA_NABDPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "bool __cdecl std::_Fgetc<char>(char &,struct _iobuf *)" (??$_Fgetc@D@std@@YA_NAADPAU_iobuf@@@Z) already defined in xsplit.obj
libcpmtd.lib(cerr.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
libcpmtd.lib(string.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "void __cdecl operator delete(void *,void *)" (??3@YAXPAX0@Z) already defined in xsplit.obj
libcpmtd.lib(locale0.obj) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in xsplit.obj
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\LIBCMTD.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
Finished searching libraries
Searching libraries
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\LIBCMTD.lib:
    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\php5ts.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:
    Searching C:\x\php-5.3.1\bindlib_w32\libcpmtd.lib:
Finished searching libraries
c:\xproject\xsplit\Debug\xsplit.dll : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\xproject\xsplit\xsplit\Debug\BuildLog.htm"
xsplit - 9 error(s), 16 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒绊 2024-08-23 04:33:48

你从哪里得到这个 libcpmtd.lib ?

  • 是否使用相同的 /Mx 进行编译设置为您的 .dll 项目?
  • 您是否在其中使用了函数级别链接或两个项目?

Where did you get this libcpmtd.lib from?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文