Error compiling testOnDemandRTSPServer.cpp (From the Live555 libraries)
I'm trying to figure out how to compile testOnDemandRTSPServer.cpp as found in the testProgs directory from the live555 media server source. I am using Ubuntu 11.04 and have installed the liblivemedia-dev libraries.
I have modified the header includes (within testOnDemandRTSPServer.cpp), to:
#include <liveMedia/liveMedia.hh>
#include <BasicUsageEnvironment/BasicUsageEnvironment.hh>
And used this command to compile:
g++ -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment testOnDemandRTSPServer.cpp -o RTSPServer
Which then results in the error:
In file included from /usr/include/liveMedia/MediaSink.hh:25:0,
from /usr/include/liveMedia/RTPSink.hh:25,
from /usr/include/liveMedia/MultiFramedRTPSink.hh:26,
from /usr/include/liveMedia/AudioRTPSink.hh:25,
from /usr/include/liveMedia/MPEG1or2AudioRTPSink.hh:25,
from /usr/include/liveMedia/liveMedia.hh:27,
from testOnDemandRTSPServer.cpp:21:
/usr/include/liveMedia/FramedSource.hh:25:23: fatal error: NetCommon.h: No such file or directory
compilation terminated.
At this point I figured sweet deal, it's just a redirection problem between header files. I then modified /usr/include/liveMedia/FramedSource.hh to use #include <groupsock/NetCommon.h>
instead of #include "NetCommon.h"
- since NetCommon.h lives in /usr/include/groupsock/
This worked, until I found a million other redirection problems like:
/usr/include/liveMedia/Media.hh:29:22: fatal error: Boolean.hh: No such file or directory
/usr/include/liveMedia/Media.hh:33:31: fatal error: UsageEnvironment.hh: No such file or directory
- Etc...
So, am I linking to the live555 libraries correctly in the first place, or will I have to constantly change the header locations as needed?
Update
So I continued to change the header locations using the aforementioned method, but now I get a mill开发者_StackOverflow中文版ion undefined reference errors... as shown here (Sorry, too much to post here)
Now I'm scratching my head, as the original testOnDemandRTSPServer.cpp compiles with no hitches (using the configure/make method); and the only thing I've changed is where to look for header files.
The Answer
By not using the Ubuntu Packaged libraries at all... But by just compiling the source code from the Live555 website.
In a custom Makefile, this is the structure I used to compile my own program and the testOnDemandRTSPServer:
LIVE_INCLUDES=-I../UsageEnvironment/include -I../groupsock/include -I../liveMedia/include -I../BasicUsageEnvironment/include
LIVE_LIBS=../liveMedia/libliveMedia.a ../groupsock/libgroupsock.a ../BasicUsageEnvironment/libBasicUsageEnvironment.a ../UsageEnvironment/libUsageEnvironment.a
g++ $(LIVE_INCLUDES) testOnDemandRTSPServer.c -c
g++ -o testOnDemandRTSPServer -L. testOnDemandRTSPServer.o $(LIVE_LIBS)
It solves the undefined reference errors as well :P
精彩评论