#c #makefile #linker #opc
Вопрос:
Я скомпилировал исходный код и создал файлы .o, но компоновщик по-прежнему возвращает ошибки ниже. Существует неопределенная ссылка на конструктор UaMutexLocker и другие, как вы можете видеть ниже. Я добавил путь к библиотеке-luabasecppd, где это содержится, но я понятия не имею, почему это не работает.
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaMutex::UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:247: undefined reference to `UaThread::start()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaThread::~UaThread()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::~UaReverseEndpoint()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:252: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:254: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:257: undefined reference to `UaThread::wait(unsigned int)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:261: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:268: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:252: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:249: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:249: undefined reference to `UaThread::~UaThread()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::registerSession(UaString constamp;, UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::registerDiscovery(UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::unregisterSession(UaString constamp;, UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::unregisterDiscovery(UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::run()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:369: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:379: undefined reference to `UaThread::msleep(unsigned int)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:381: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::beginConnect()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:406: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:445: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:447: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:451: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::disconnect()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::removeChannel(void*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::invalidateChannel(void*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::UaReverseEndpointList()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:524: undefined reference to `UaMutex::UaMutex()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::~UaReverseEndpointList()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:527: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::getReverseEndpoint(UaString constamp;)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::decrementEndpoint(UaClientSdk::UaReverseEndpoint*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:560: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::endpointCount()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:567: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:567: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o):(.data.rel.ro._ZTVN11UaClientSdk17UaReverseEndpointE[_ZTVN11UaClientSdk17UaReverseEndpointE] 0x48): undefined reference to `UaThread::start()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o):(.data.rel.ro._ZTIN11UaClientSdk17UaReverseEndpointE[_ZTIN11UaClientSdk17UaReverseEndpointE] 0x28): undefined reference to `typeinfo for UaThread'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: aplikace] Chyba 1
The terminal process "bash '-c', '/home/michal/Dokumenty/OPCUA_adapter/sdk/examples/client_gettingstarted/lesson01/build.sh'" terminated with exit code: 2.
Terminal will be reused by tasks, press any key to close it.
Мой файл Makefile таков. У кого-нибудь есть
cc=g
cflags=-g -Wall
libflags=-L/home/michal/Dokumenty/OPCUA_adapter/sdk/lib -luamoduled -luamodelsd -lcoremoduled -luabasecppd -luastackd -lxmlparsercppd -luapkicppd -luaclientcppd -lxml2 -lssl -lcrypto
includes=-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uabasecpp
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uastack
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uaclientcpp
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uapkicpp
objfiles=client_cpp_sdk_tutorial.o sampleclient.o
vystup=aplikace
%.o : %.cpp
$(cc) $(cflags) $(includes) -c
lt;
# startovaci pravidlo
vychozi: $(vystup)
# zavislosti
dep:
$(cc) -MM *.cpp >dep.list
-include dep.list
clean:
rm aplikace $(objfiles)
# slinkování aplikace
$(vystup): $(objfiles)
$(cc) $(cflags) $(objfiles) $(libflags) $(includes) -o $@
Комментарии:
1. Ты можешь поставить
-luaclientcppd
передо-luabasecppd
мной ? Подозреваю, что приказ может быть причиной