PDA

View Full Version : QMAKE_CXX.COMPILER_MACROS is not defined



Panda281
17th April 2023, 22:14
Hi together,

I just wanted to work with a "Getting Started with Qt5"-book and a "Hello-World"-project but now I have some difficulties when
using qmake in a termial / console i.e. not using Qt-Creator. So here is my source ( not really spectacular ):




#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel label("Hallo Werner!");
label.show();
return app.exec();
}



"qmake" is not found but "qmake6" is found and returns help-information.
"qmake6 -project" returns "Variable QMAKE_CXX.COMPILER_MACROS is not defined." but a
project-file is created.
When I type "qmake6" again, then a Makefile is also created.

But when I finally type "make" then I get "

hello.cpp:1:10: fatal error: QApplication: Datei oder Verzeichnis nicht gefunden
1 | #include <QApplication>
| ^~~~~~~~~~~~~~

In Qt-Create under settings->kits I get with "Desktop Qt 6.4.2 GCC 64bit" an orange warning
sign and the warning:
The CMAKE-Configuration has set a C-compiler although the kit has no valid toolchain.

Anyway the QLibraries are not found.

Op-system ist OpenSuse-Linux Leap 15.4,
Installation is non commercial and was done using the Qt-Maintenance Tool.

Any hint what is wrong with my installation? Under Qt4 everything worked fine.

Best regards
Werner

d_stranz
17th April 2023, 23:55
What do you get when you run these from a terminal window?



qmake -query QMAKE_SPEC

qmake -query QT_INSTALL_PREFIX


(or qmake6 if that's what your Qt version uses). If QMAKESPEC (https://doc.qt.io/qt-6/qmake-environment-reference.html#qmakespec) isn't set, then you have a configuration problem.

You can set properties using qmake:



qmake -set QT_INSTALL_PREFIX /path/to/top_of_qt_install


where "/path/to/top_of_qt_install" is the directory where the "bin", "lib", "include", etc. directories can be found for your Qt distro.

Panda281
18th April 2023, 19:24
Dear d_stranz,

with



qmake6 -query QMAKE_SPEC

I get "linux-g++"

and with



qmake6 -query QT_INSTALL_PREFIX

I get at first "**Unknown**"

and after



qmake6 -set QT_INSTALL_PREFIX /usr/lib64/qt6
qmake6 -query QT_INSTALL_PREFIX


I only get "/usr" but not the complete path as written above. This seems strange to me. I
expected to see "/usr/bin64/qt6"

Any help please?

d_stranz
19th April 2023, 00:34
Any help please?

I don't know. Maybe try putting /usr/lib64/qt6 in quotes?



qmake6 -set QT_INSTALL_PREFIX "/usr/lib64/qt6"


Edit:


I only get "/usr" but not the complete path as written above. This seems strange to me. I expected to see "/usr/bin64/qt6"

Now wait - what is it, /usr/lib64/qt6 or /usr/bin64/qt6? If there is no Qt installation at whatever you tried, then it could fail.

Panda281
1st May 2023, 17:14
I don't know. Maybe try putting /usr/lib64/qt6 in quotes?



qmake6 -set QT_INSTALL_PREFIX "/usr/lib64/qt6"


Edit:

Now wait - what is it, /usr/lib64/qt6 or /usr/bin64/qt6? If there is no Qt installation at whatever you tried, then it could fail.


Hi,
meanwhile I erased QT5 and QT6 using Qt Maintenance and I also deleted all the related directories. "qmake6 -set" and "qmake6 -unset"
didn't work. qmake -query QT_INSTALL_PREFIX always returned /usr.
Then I reinstalled QT6 and QT5 from https://www.qt.io/download. You have the possibility to choose Qt 6.5.0, Qt 6.4.3, Qt 5.15.2
and a few others during installation. More than one version can be selected. The version (kit) can be selected later during your development.
As I had problems with Qt 6 I successfully tried Qt 5.15.2 (desktop).
After the installation I found the complete installation directories under my local directory, including qmake. In order to be able to
call qmake directly without typing the whole path I created a symbolic link under /usr/bin that points to
/home/myname_xy/Qt/6.5.0/gcc_64/bin/qmake. "qmake -query QT_INSTALL_PREFIX" now returns /home/myname_xy/Qt/6.5.0/gcc_64.
So I was misleaded earlier when I was trying to use the installation under the root directory. The complete installation is to be found
under my local directory.

"qmake -project" and "qmake" are now working in the shell as expected.
Only "make" tells me that QApplication, QLabel and the others cannot be found.
I have no solution for that. Do you have any idea how to fix that? Has this to do
with the selected version/kit? In Creator everthing works fine when I select Qt 5.15.2 desktop.

So far it is ok.

Regards [/QUOTE]

britsfp
15th April 2024, 11:29
I think Qt and all the users that have this problem are going to have it for a very long time time still.
The newest versions of Qt still have this issue.

Regards
Frik Brits