How to resolve undefined referece error when actually all function have defination and header ?
-
wrote on 17 Feb 2024, 13:47 last edited by
Hi I have included the template = lib based static lib project's one c++ class file function into template = app based project.
i don't know how to link this library and in what order i need to add sequence of building project.
i have perfectly implemented the c++ class .
When i build this project at that time it throws below error :
/usr/bin/ld: Main.o: in function `main': /home/host/HOST/MainDir/Project/App/Main.cpp:17: undefined reference to `Engine::getInstance()' /usr/bin/ld: /home/host/HOST/MainDir/Project/App/Main.cpp:17: undefined reference to `Engine::setQmlEngine(QSharedPointer<QQmlApplicationEngine> const&)' collect2: error: ld returned 1 exit status make[1]: Leaving directory '/home/host/HOST/TWS_11_02_2024/15FEB2023/SubDirPOC/build-Project-Desktop_Qt_5_15_2_GCC_64bit-Debug/App' make[1]: *** [Makefile:246: App] Error 1 make: *** [Makefile:73: sub-App-make_first] Error 2 19:03:26: The process "/usr/bin/make" exited with code 2. Error while building/deploying project Project (kit: Desktop Qt 5.15.2 GCC 64bit) When executing step "Make"
I have proper function for setQmlEngine method. but where i made mistake i want to know can any body help me how to resolve it.
-
wrote on 17 Feb 2024, 19:51 last edited by Qt embedded developer
@SGaist This Part is learning for me. Because Yes i had not linked it.
But when i have linked it
Like
LIBS += FULLPATH/libComponents.a
It works fine.
But what to do if we don't want to give full path and want to use another smart way so that i have to not write that full path.
LIBS +=$$OUT_PWD/../Components/libComponents.a
-
Hi,
How do you link to your library ?
Are you sure things are done in the proper order ? -
wrote on 17 Feb 2024, 19:51 last edited by Qt embedded developer
@SGaist This Part is learning for me. Because Yes i had not linked it.
But when i have linked it
Like
LIBS += FULLPATH/libComponents.a
It works fine.
But what to do if we don't want to give full path and want to use another smart way so that i have to not write that full path.
LIBS +=$$OUT_PWD/../Components/libComponents.a
-
1/3