编译并使用Live555 Libs -Windows和Mingw(未解决的引用)

Compile and use Live555 libs - Windows and MinGW (unresolved references)

本文关键字:Mingw 未解决 引用 -Windows Live555 Libs 编译      更新时间:2023-10-16

我正在尝试使用mingw在Windows上编译Live555库。该官员并没有真正指定如何做(只有VC和Borland)。我编辑了win32config,所以它说:

NODEBUG=1
TARGETOS = WINNT
UI_OPTS =       $(guilflags) $(guilibsdll)
CONSOLE_UI_OPTS =       $(conlflags) $(conlibsdll)
CPU=i386
TOOLS32 =       C:Toolsmingw491_32bin
COMPILE_OPTS =      $(INCLUDES) $(cdebug) $(cflags) $(cvarsdll) -I. -I"$(TOOLS32)include"
C =         c
C_COMPILER =        "$(TOOLS32)gcc.exe"
C_FLAGS =       $(COMPILE_OPTS)
CPP =           cpp
CPLUSPLUS_COMPILER =    "$(TOOLS32)g++.exe"
CPLUSPLUS_FLAGS =   $(COMPILE_OPTS)
OBJ =           o
LINK =          $(CXX) -o 
LIBRARY_LINK =      $(LD) -o 
LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic
LINK_OPTS =     -L.
CONSOLE_LINK_OPTS = $(LINK_OPTS_0) $(CONSOLE_UI_OPTS)
SERVICE_LINK_OPTS =     kernel32.lib advapi32.lib shell32.lib -subsystem:console,$(APPVER)
LIB_SUFFIX =        lib
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
MULTIMEDIA_LIBS =   winmm.lib
EXE =           .exe
PLATFORM = Windows
rc32 = "$(TOOLS32)binrc"
.rc.res:
    $(rc32) $<

然后,我运行genwindowsmakefiles.cmd文件,该文件在子文件夹中创建 *.mak文件。我将它们重命名为Makefile,并在每个子文件夹中进行一次跑步:USAGEENVIRNTMENT,GROUPSOCK,LIVEMEDIA,BASICUSUSAGEENVIRONMENT。这给了我 *.lib文件,但是当我在项目中链接它们时,我得到了很多未解决的参考文献:

c:/Tools/live555/libBasicUsageEnvironment.lib:BasicUsageEnvironment.cpp:(.text+0x502): undefined reference to `_imp__WSAGetLastError@0'
c:/Tools/live555/libBasicUsageEnvironment.lib:BasicTaskScheduler.cpp:(.text+0xf89): undefined reference to `_imp__closesocket@4'
c:/Tools/live555/libBasicUsageEnvironment.lib:BasicTaskScheduler.cpp:(.text+0x11ca): undefined reference to `_imp__select@20'
c:/Tools/live555/libBasicUsageEnvironment.lib:BasicTaskScheduler.cpp:(.text+0x11e1): undefined reference to `_imp__WSAGetLastError@0'
c:/Tools/live555/libBasicUsageEnvironment.lib:BasicTaskScheduler.cpp:(.text+0x147a): more undefined references to `__WSAFDIsSet@8' follow

和错误:

c:/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: c:/Tools/live555/libgroupsock.lib: warning: COMDAT symbol '.eh_frame$_ZNK10NetAddress4dataEv' does not match section name '.eh_frame'
c:/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: c:/Tools/live555/libliveMedia.lib: warning: COMDAT symbol '.eh_frame$_ZNK9HashTable7IsEmptyEv' does not match section name '.eh_frame'
c:/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: c:/Tools/live555/libBasicUsageEnvironment.lib: bad reloc address 0x1c in section `.text$_ZN13DelayIntervalC1Ell[__ZN13DelayIntervalC1Ell]'

知道我做错了什么?我该如何修复?

mingw更靠近unix风格的makefile,而不是尝试适应VC Makefile,而是应该尝试:

./genMakefiles mingw
make

我设法解决了问题。未定义的参考来自Winsock库。它在编译Live555时链接了,但是我没有使用Live555链接在项目中(我不知道应该)。将-lws2_32添加到链接选项解决问题。

时,我还以" _unwind _ "关键字遇到了对许多功能的不确定引用 - 原因是在构建Live555和项目中使用的编译器版本之间的原因是不兼容的。

<</p> <</p> <</p>