每个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标头。
编辑:右侧的截止应该是固定的
解决方案非常简单。我改了这个:
testrtsp:testrtsp.o
gcc -L. $(LDFLAGS) -o $@ $(LIVE_LIBS) $<
到此:
testrtsp: testrtsp.o
gcc -L. $(LDFLAGS) -o $@ $< $(LIVE_LIBS)
相关文章:
- 对C宏的未定义引用,但在定义它时会出现重新定义错误
- 编译时的 CImg 库返回对"__imp_SetDIBitsToDevice"的未定义引用
- 对Py_Initialize()的未定义引用
- 使用mysql c++连接器的未定义引用
- 对 Scalar ::Scalar() 的未定义引用
- 对复制 CTOR 和 CTOR 的未定义引用
- 对显式实例化的模板函数的未定义引用
- TensorRT (C++ API) 对"createNvOnnxParser_INTERNAL"的未定义引用
- 2个模板化类的非模板友元函数未定义引用错误
- 编译 libfluid 样本控制器时对"event_base_del_virtual"的未定义引用
- 获取对function_name的未定义引用
- 对 'std::thread::_M_start_thread CMake 的未定义引用进行基准测试
- 对结构方法的未定义引用
- 使用内联函数 c++ 的未定义引用
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 对 DLOPEN 的未定义引用
- QT C++中对全局变量的未定义引用
- 快速数学导致对"__pow_finite"的未定义引用
- 对 boost::system::d etail::system_category_instance 的未定义引用,从
- OpenCV 3.4.3 中对 'cv::String::d eallocate()' 错误的未定义引用