在OpenSuse下编译QTProject时出错



我尝试使用cmake在opensuse下编译我的项目来生成makefile。

现在,我得到了这个错误。有人可以在这里帮我吗?

[ 18%] Building CXX object VSProjects/PROJECT/CMakeFiles/PROJECT.dir/src/Activity/ActivityFactory.cpp.o
In file included from /home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:97:0,
                 from /home/martin/Qt/5.8/gcc_64/include/QtCore/qchar.h:43,
                 from /home/martin/Qt/5.8/gcc_64/include/QtCore/qstring.h:48,
                 from /home/martin/Qt/5.8/gcc_64/include/QtCore/QString:1,
                 from /home/martin/VSProjects/PROJECT/src/Activity/ActivityFactory.cpp:51:
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:357:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT const char *qVersion() Q_DECL_NOTHROW;
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:649:12: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
            ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:657:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT bool qSharedBuild() Q_DECL_NOTHROW;
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:697:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:702:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:719:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:750:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT void qt_check_pointer(const char *, int);
 ^
/home/martin/Qt/5.8/gcc_64/include/QtCore/qglobal.h:751:1: error: expected constructor, destructor, or type conversion before ‘(’ token
 Q_CORE_EXPORT void qBadAlloc();

i挖掘到cmakelists.txt中并弄清楚,一个coluege已将-dwin64添加到编译器标志中。

QT知道它在Windows下进行编译,并添加" Q_OS_WIN"定义

现在q_core_export正在寻找__declspec宏...

您正在调用这些函数: *qversion();qterminate();qt_error_string();等。

看来您没有在正确的位置调用它们(预期的构造函数,destructor或键入"("(''')之前,必须在功能中声明:

bool someclass() 
{ 
 qSharedBuild(); --bool type
 return false;
}

相关内容

  • 没有找到相关文章

最新更新