Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Project dependency?



  • I have 2 project files A and B. Project A depends on Project B which is configured as a static lib. I couldn't find the option to specify the linker's search path but I did find the project dependency option so I set project b as a dependency of project a thinking this will accomplish this. However, upon building project A I got an undefined reference error. I assume setting the dependency doesn't make the linker look for the object files of project b. If so what should I do to fix the error?



  • The information you provided are a bit sketchy :)

    Without knowing what IDE you're using etc etc the best I can do is point you in the direction of qMake. Have a look at the LIBS and INCLUDEPATH
    variables:

    https://qt-project.org/doc/qt-5/qmake-variable-reference.html#libs
    https://qt-project.org/doc/qt-5/qmake-variable-reference.html#includepath

    Hope that helps :)



  • I've added the project target into LIBS, added in the header search path into INCLUDEPATH and this solves the problem.

    I apologize if the way I worded the problem comes out as rather ambiguous. I'm using the latest version of Qt Creator (of course). I am not aware of other ide that is tailored for Qt development which integrates well with qmake and moc.



  • No problem, some tools just allow you to add dependencies without having to modify the .pro file manually.

    If this solved it for you, please mark the thread accordingly :)


Log in to reply