Unsolved undeclared identifier in QtCore files.
-
Hi,
I am new to qt Development and am trying some tutorials to begin with. I used google to help myself but could not find a valid solution, so now I am here. I build the latest version qt 5.7 from Git following the instructions here:
https://wiki.qt.io/Building_Qt_5_from_Git.
My problem occurs when I try to compile this with g++ or clang++3.5:
#include <QtCore>
#include <iostream>int main() {
std::cout << "Qt version: " << qVersion() << std::endl;
}.
Using g++, I get these error messages: (the message is takes several dozen lines so I just give some snippets.)
snippet1:
In file included from /usr/local/qt5/qtbase/include/QtCore/qcompilerdetection.h:1:0,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:83,
from /usr/local/qt5/qtbase/include/QtCore/qglobal.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qnamespace.h:43,
from /usr/local/qt5/qtbase/include/QtCore/qnamespace.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:48,
from /usr/local/qt5/qtbase/include/QtCore/qobjectdefs.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:46,
from /usr/local/qt5/qtbase/include/QtCore/qobject.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/animation/qabstractanimation.h:43,
from /usr/local/qt5/qtbase/include/QtCore/qabstractanimation.h:1,
from /usr/local/qt5/qtbase/include/QtCore/QtCore:4,
from testqt.cpp:1:
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qcompilerdetection.h:562:6: error: #error Qt requires a C++11 compiler and yours does not seem to be that.
error Qt requires a C++11 compiler and yours does not seem to be that.Snippet2:
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:93:23: error: ‘QAtomicOpsSupport’ was not declared in this scope
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:756:110: note: in definition of macro ‘Q_STATIC_ASSERT’
enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)}
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:93:5: note: in expansion of macro ‘Q_STATIC_ASSERT_X’
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:93:51: error: ‘::IsSupported’ has not been declared
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:756:110: note: in definition of macro ‘Q_STATIC_ASSERT’
enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)}
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:93:5: note: in expansion of macro ‘Q_STATIC_ASSERT_X’
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:756:120: error: template argument 1 is invalid
enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)}
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:761:47: note: in expansion of macro ‘Q_STATIC_ASSERT’
#define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:93:5: note: in expansion of macro ‘Q_STATIC_ASSERT_X’
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
In file included from /usr/local/qt5/qtbase/include/QtCore/qbasicatomic.h:1:0,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qatomic.h:46,
from /usr/local/qt5/qtbase/include/QtCore/qatomic.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:1145,
from /usr/local/qt5/qtbase/include/QtCore/qglobal.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/global/qnamespace.h:43,
from /usr/local/qt5/qtbase/include/QtCore/qnamespace.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:48,
from /usr/local/qt5/qtbase/include/QtCore/qobjectdefs.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:46,
from /usr/local/qt5/qtbase/include/QtCore/qobject.h:1,
from /usr/local/qt5/qtbase/include/QtCore/../../src/corelib/animation/qabstractanimation.h:43,
from /usr/local/qt5/qtbase/include/QtCore/qabstractanimation.h:1,
from /usr/local/qt5/qtbase/include/QtCore/QtCore:4,
from testqt.cpp:1:
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:95:14: error: ‘Ops’ has not been declared
typename Ops::Type _q_value;*Using clang++- 3.5, I get *
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:95:14: error: use of undeclared identifier 'Ops'
typename Ops::Type _q_value;
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:95:19: error: expected a qualified name after 'typename'
typename Ops::Type _q_value;
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:95:23: error: expected ';' at end of declaration list
typename Ops::Type _q_value;
^
;
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:99:44: error: use of undeclared identifier 'Ops'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:99:54: error: use of undeclared identifier '_q_value'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:100:45: error: use of undeclared identifier 'Ops'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:100:56: error: use of undeclared identifier '_q_value'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:102:51: error: use of undeclared identifier 'Ops'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:102:68: error: use of undeclared identifier '_q_value'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:103:52: error: use of undeclared identifier 'Ops'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:103:70: error: use of undeclared identifier '_q_value'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/usr/local/qt5/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:107:86: error: use of undeclared identifier 'Ops'
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }I hope someone can help me.
cheers, Andreas
-
Hi and welcome to devnet,
What OS are you running ? And what exact version of the compilers ?
In any case, if you want to study Qt, there's no need to build from scratch. You can install the latest pre-built package.
-
@SGaist Hey, First of all: thank you for the quick response. Shame on me, I managed to forget to provide some crucial informations. When I posed my question, I had kubuntu 14.04 but I upgraded to 16.04. I downloaded the *.run file and used the installer, is this sufficent? At last, the simple example runs now.
-
Yes, it should be enough.
Happy hacking !