Error while making example file
-
@jsulm Hey! Thank you for your response, I already have
QT += openglwidgets in my .pro file, that's why this error surprises me... -
@ferocito hi,
Did you check that the Qt version you use is a universal build ?
Did you use the online installer to install it ?
-
@ferocito hi,
Did you check that the Qt version you use is a universal build ?
Did you use the online installer to install it ?
-
J jsulm referenced this topic on
-
@SGaist Hey! Yes I used the online installer to install it.
I juste reinstalled the 6.4.2 version and I made sure in the online installer that it was the universal build, but the error's still here...@ferocito
I don't know, but https://doc.qt.io/qt-6/qtopengl-index.html#building-with-qmake documenting changes from Qt 5 to 6 says you need:QT += opengl
Try that as well as/instead of
QT += openglwidgets
, any help? Don't forget to re-runqmake
when changing the.pro
file! -
@ferocito
I don't know, but https://doc.qt.io/qt-6/qtopengl-index.html#building-with-qmake documenting changes from Qt 5 to 6 says you need:QT += opengl
Try that as well as/instead of
QT += openglwidgets
, any help? Don't forget to re-runqmake
when changing the.pro
file! -
@JonB Still the same error... A friend tried to do the same routine as mine on his mac, and same errors too...
Can you provide a minimal example that triggers this error ?
-
@JonB Still the same error... A friend tried to do the same routine as mine on his mac, and same errors too...
@ferocito When running any type of project...
The last error i mentioned in my post comes from an example project directly provided by Qt and findable at
/Users/{UserName}/Qt/Examples/Qt-6.4.2/widgets/tools/plugandpaint
However, when i create a simple project with just an empty window, it works perfectly...
-
Hey,
I need to use Qt for a school project, so I downloaded the 6.4.2 version and tried to build the example project the teacher gave us, but I struggled with this error :./glwidget.h:3:10: fatal error: 'QOpenGLWidget' file not found
Note that the error is related to a
#include <QOpenGLWidget>
in a .h file of the project.
I succeed to resolve this error by adding
INCLUDEPATH += /path/to/header/file
to the .pro file, but another error came up :
ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1
I tried to add this (with ChatGPT help) on the .pro file :
QMAKE_MACOSX_DEPLOYMENT_TARGET = 12.5 QMAKE_APPLE_DEVICE_ARCHS = arm64 LIBS += -framework QtWidgets -framework QtOpenGL
but it didn't change anything...
When changing arm64 to x86_64, same error :
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1
In my despair, I tried to build one of the examples the 6.4.2 Qt version provides :
cd /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app qmake make -config release
And as i was expecting, another error :
ld: library not found for -lpnp_basictools clang: error: linker command failed with exit code 1
I have
QT += openglwidgets
in my .pro file, so the problem is not related to this.
After hours spent on ChatGPT and hours trying to explain my problem to the course assistants, this forum is my last hope before resetting my Mac.
If this can help, I'm on a M2 Macbook Air, version 12.5.
Thank you if you made it this far, hope someone will be able to help me.
The plug and Paint example should be built from this folder
/path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint
not
/path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app
Using the latter folder will not build the plugin libraries, one of which is the subject of the complaint:
ld: library not found for -lpnp_basictools clang: error: linker command failed with exit code 1
-
The plug and Paint example should be built from this folder
/path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint
not
/path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app
Using the latter folder will not build the plugin libraries, one of which is the subject of the complaint:
ld: library not found for -lpnp_basictools clang: error: linker command failed with exit code 1
@ChrisW67 I did this and still the same error...
I searched the "lpnp_basictools" library in my computer, and i didn't find it. Maybe Qt doesn't find this library because it simply doesn't exist on my computer.
It's weird because I installed Qt with the Qt online installer...
Maybe one thing that can help : I only installed the MacOS version, and didn't install the IOS modules (they weight 17 GB and I don't need to make apps for IOS).
However, I tried to build and run another example :
/path/to/Qt/Examples/Qt-6.4.2/statemachine
and it works perfectly.
It's weird because the example my teacher gave me is a simple colored triangle display, without any animation and interaction, and I can't run it, while the statemachine example seems way more complicated, with interaction and animations...
-
@ChrisW67 I did this and still the same error...
I searched the "lpnp_basictools" library in my computer, and i didn't find it. Maybe Qt doesn't find this library because it simply doesn't exist on my computer.
It's weird because I installed Qt with the Qt online installer...
Maybe one thing that can help : I only installed the MacOS version, and didn't install the IOS modules (they weight 17 GB and I don't need to make apps for IOS).
However, I tried to build and run another example :
/path/to/Qt/Examples/Qt-6.4.2/statemachine
and it works perfectly.
It's weird because the example my teacher gave me is a simple colored triangle display, without any animation and interaction, and I can't run it, while the statemachine example seems way more complicated, with interaction and animations...
@ferocito said in Error while making example file:
I searched the "lpnp_basictools" library in my computer, and i didn't find it
The name of the library should be: libpnp_basictools.so.*
-lpnp_basictools means: -l is the parameter telling linker to link libpnp_basictools.so library. -
@ferocito said in Error while making example file:
I searched the "lpnp_basictools" library in my computer, and i didn't find it
The name of the library should be: libpnp_basictools.so.*
-lpnp_basictools means: -l is the parameter telling linker to link libpnp_basictools.so library. -
@ferocito The file is built as one of the plugins in the Plug & Paint example.
The example code is here and the specific sub-project that builds the library is atplugins/basictools/basictools.pro
$ cd ~/Qt/Examples/Qt-6.4.2/widgets/tools/plugandpaint $ qmake $ make ... $ ls -F . plugins .: app/ CMakeLists.txt Makefile plugandpaint* plugandpaint.pro plugins/ plugins: basictools/ CMakeLists.txt extrafilters/ libpnp_basictools.a libpnp_extrafilters.so* Makefile plugins.pro