每个 live555 元素的未定义引用

undefined reference for every live555 element

我在使用 lib555 编译程序时遇到此错误。我似乎在 Makefile 中遗漏了一些东西:

testrtsp.o: In function `main':
testrtsp.cpp:(.text+0x470): undefined reference to BasicTaskScheduler::createNew(unsigned int)'
testrtsp.cpp:(.text+0x480): undefined reference to `BasicUsageEnvironment::createNew(TaskScheduler&)'
testrtsp.cpp:(.text+0x49c): undefined reference to `Port::Port(unsigned short)'
testrtsp.cpp:(.text+0x4b0): undefined reference to `RTSPServer::createNew(UsageEnvironment&, Port, UserAuthenticat
ionDatabase*, unsigned int)'

collect2: error: ld returned 1 exit status
Makefile:64: recipe for target 'testrtsp' failed

我的 Makefile 如下所示:

# generated from pkg-config --cflags gstreamer-0.10
CFLAGS=-pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 

LIVE_INCLUDES=-I/home/root/live/UsageEnvironment/include -I/home/root/live/groupsock/include -I/home/root/live/liveMedia/include -I/home/root/live/BasicUsageEnvironment/include 
LIVE_LIBS=/home/root/live/liveMedia/libliveMedia.a /home/root/live/groupsock/libgroupsock.a /home/root/live/BasicUsageEnvironment/libBasicUsageEnvironment.a /home/root/live/UsageEnvironment/libUsageEnvironment.a

LIVE_LIBS+=-lpthread          
                        CXXFLAGS=$(CFLAGS)                                                              
    # generated from pkg-config --libs gstreamer-0.10 
LDFLAGS=-lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -pthread -lgthread-2.0 -pthread -lglib-2.0 -lxml2 -lgstapp-0.10  

CFLAGS+=-I/usr/include/opencv2                        
CFLAGS+=-I/home/root/live/liveMedia/include             
CFLAGS+=-I/home/root/live/groupsock/include           
CFLAGS+=-I/home/root/live/UsageEnvironment/include 
CFLAGS+=-I/usr/include/gtk-2.0                   
CFLAGS+=-I/usr/include/cairo                         
CFLAGS+=-I/usr/inlcude/pango-1.0                        
CFLAGS+=-I/usr/lib/gtk-2.0/include                    
CFLAGS+=-I/usr/include/gdk-pixbuf-2.0                          
CFLAGS+=-I/usr/include/atk-1.0                         
CFLAGS+=-I/usr/include/rtsp-server                      
CFLAGS+=-I/home/root/live/BasicUsageEnvironment/include/       
CFLAGS+=-I/usr/include/  

LDFLAGS+=-lstdc++ -lopencv_core -lopencv_features2d -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_video

all: testrtsp   
testrtsp: testrtsp.o                                                      
            gcc -L. $(LDFLAGS) -o $@ $(LIVE_LIBS) $<                                

            testrtsp.o: testrtsp.cpp                                                


                gcc -c $(CFLAGS) $(LIVE_INCLUDES) -o $@ $< 

我在程序中包含了所有需要的 live555 Headers。

编辑:右边的截断应该是固定的

解决方案非常简单。我改变了这个:

testrtsp:testrtsp.o                                                      
gcc -L. $(LDFLAGS) -o $@ $(LIVE_LIBS) $< 

对此:

testrtsp: testrtsp.o                                                      
gcc -L. $(LDFLAGS) -o $@ $< $(LIVE_LIBS)