编译报错:
multiple definition of `xmlMemStrdup' GStreamPlayer
line 75, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\iostream
C/C++ Problem
multiple definition of `xmlMalloc' GStreamPlayer
line 75, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\iostream
C/C++ Problem
multiple definition of `forbiddenExp' CGStreamBuilder.cpp
/GStreamPlayer/Src line 246
C/C++ Problem
multiple definition of `xmlMallocAtomic' GStreamPlayer
line 75, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\iostream
C/C++ Problem
multiple definition of `emptyExp' CGStreamBuilder.cpp
/GStreamPlayer/Src line 246
C/C++ Problem
multiple definition of `xmlRealloc' GStreamPlayer
line 75, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\iostream
C/C++ Problem
multiple definition of `xmlFree' GStreamPlayer
line 75, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\iostream
C/C++ Problem
解决方法:
定义宏:LIBXML_STATIC
在头文件xmlexports.h 中有如下问题:
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
/*
* if defined(IN_LIBXML) this raises problems on mingw with msys
* _imp__xmlFree listed as missing. Try to workaround the problem
* by also making that declaration when compiling client code.
*/
#if !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
本文详细介绍了如何通过定义宏解决GStreamer项目在编译时遇到的多个函数定义错误问题,包括xmlMemStrdup、xmlMalloc等函数在不同位置多次被定义的情况。解决方案涉及到在头文件中修改特定的宏定义,以避免Windows Mingw环境下出现的冲突。
1163

被折叠的 条评论
为什么被折叠?



