Qt World Summit: Register Today!

library not found for -lcomponents

  • Hello,

    So, I tried to add qt-material-widgets to my project. In the beginning, everything worked fine, but when I restarted my laptop I got these errors:

    error: library not found for -lcomponents
    error: linker command failed with exit code 1 (use -v to see invocation)

    How I add these qt-material-widgets to my project:

    1. I downloaded files from the qt-material-widgets github
    2. I builder the qt-material-widgets.pro file
    3. Then I added components file and libcomponents.a file (from build-qt-material-widgets- file) to my project:

    Screenshot 2020-05-27 at 23.00.15.png

    1. And my last step was:
    INCLUDEPATH += components/
    LIBS += -L$$PWD/./ -lcomponents

    What did I do wrong?

    By the way, if i reinstall the qt-material-widgets and re-do these steps everything works fine, but if i turn off my laptop and then turn it back on, I am getting these errors again.

  • Lifetime Qt Champion

    @privatepepper Since it's a static lib:

    LIBS += $$PWD/libcomponents.a

  • @jsulm

    Thanks for the help, I changed my code to:

    LIBS += $$PWD/libcomponents.a

    And now I am getting a new error:

    error: no such file or directory: '/Users/L/Documents/C++/Projects/Sorting-Algorithms/Sorting_Algorithms/libcomponents.a/'

  • Lifetime Qt Champion


    From your picture, that file was not downloaded (see the cloud icon). Where exactly is it stored ?

  • @SGaist

    Ohhh..., I clicked on cloud icon and downloaded that file, and my project started working, thank you:)

Log in to reply