I am trying to build a simple Qt app with the VTK libraries included, but I am getting a link error:
The Reg....A functions are unresolved (like RegOpenKeyExA) referenced
from vtksys.lib.
I think that I have Advapi32.lib linked.
Am I supposed to specify ASCII in the build somehow or is a library missing or what?
What does your CMakeLists.txt look like? You should have a line like:
target_link_libraries(YourProgram QVTK ${VTK_LIBRARIES})
What is your compiler used to build VTK? And Qt? Are them identical? It seems most linked problems between Qt and VTK are due to mismatching library files.
Related
It's not answer, but yet another question! While compiling a cmake generated ninja build for Qt, we get such an error - #include "../../../../../../../e:/github/Qt/qtbase/src/corelib/animation/qparallelanimationgroup.h", or something like this. Of course, the file won't be found.
Where, I gess, is the fault - in cmake or in a cmake script for Qt building?
It happens from version into version, when you build QT a 'disk-away' far from its sources location.
As it is generated automatically, it should be found and corrected in Qt source files!
I have a Qt Quick project that uses CMake as its build system. I mostly went with the Qt Creator-generated CMake project, so I have
set(CMAKE_AUTORCC ON)
in my root CMakeLists.txt.
I recently learned about ahead-of-time compiling for QML resources which is supposed to yield quite a bit of startup time improvement. The documentation that describes how to use this with CMake says that I need to do the following:
find_package(Qt5 COMPONENTS Quick Core Network)
find_package(Qt5QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES})
qt5_use_modules(myapp Quick Core Network)
but as far as I see, qtquick_compiler_add_resources does nothing but produce a list of C++ files which don't exist. I assume those would be produced by the QtQuick compiler, but as it is, CMake doesn't run because it can't find those sources. What is the missing bit?
Sorry, a bit late to the party but have to you tried removing the set(CMAKE_AUTORCC ON) ?
I have almost the same implementation and the <qmlfile_name>_qml.cpp files are generated and compiled correctly.
In my implementation I have :
a different CMake property name (resource_files)
I am not using AUTORCC
I'm auto-generating the qrc/qmldir files in the build directory (but that shouldn't matter)
I added the qml files list in the add_executable parameter list because I want to see them in my IDE.
I'm trying to build a Qt Quick Controls application with CMake. I use the following documentation:
http://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html
When running CMake, I'm getting this error:
By not providing "FindQt5QuickCompiler.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5QuickCompiler", but CMake did not find one.
Could not find a package configuration file provided by "Qt5QuickCompiler"
with any of the following names:
Qt5QuickCompilerConfig.cmake
qt5quickcompiler-config.cmake
at this line:
FIND_PACKAGE(Qt5QuickCompiler)
Obviously CMake doesn't find Qt5QuickCompiler. I checked in my Qt folder (C:\Qt) but it's not there. Yet I could run this application with QMake.
What do I need to set in order to find Qt5QuickCompiler?
I just stumbled upon the same issue with Qt 5.12 under Linux. The documentation under https://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html currently seems to be wrong.
Use QuickCompiler after COMPONENTS in the Qt5 find_package instead of trying to add it via find_package(Qt5QuickCompiler). Adapting the example from the link, use
find_package(Qt5 COMPONENTS Quick Core Network QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
instead of
find_package(Qt5 COMPONENTS Quick Core Network)
find_package(Qt5QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
The error is pretty clear: CMake doesn't have a module for the Qt5QuickCompiler to find it. It just doesn't know what it is. I've just checked the corresponding cmake folder and it doesn't have that file. I'm not sure what that Qt documentation page is talking about but there is no such a file in the CMake distribution. Maybe Qt sources have this file somewhere?
You need to build Qt5 with Qt Quick compiler which you can download from http://www.qt.io/qt-quick/. In the build directory of Qt Quick compiler, you will find Qt5QuickCompilerConfig.cmake.
Copy the path to this directory, and add to CMAKE_PREFIX_PATH like this
cmake -DCMAKE_PRFEIX_PATH=<pathToFile> <pathToSrcDirOfYourProject>
In my Android native project, I need to use some core Qt functionality. Following the instructions at http://qt-project.org/wiki/Qt5ForAndroidBuilding, I managed to build Qt for Android. I can see that all the generated archive files are stored in qtbase/lib directory.
I am linking my C++ code with libQt5Core.a, libQt5Bootstrap.a, and libqtpcre.a. Almost all of my Qt references are resolved exception two non-qt references - compress() and uncompress(). I have searched for these symbols in qtbase/lib/*.a files but haven't found any definition.
So where are these two functions defined? Are they in one of the standard NDK libraries or do I need to build something separately?
It seems qbytearray.cpp is using these two functions. It seems these functions are defined if QT_NO_COMPRESS is not defined. Looks like I could get away with the unresolved errors if I could somehow define QT_NO_COMPRESS. How do I define this? Do I pass it to configure script?
$ ./configure -DQT_NO_COMPRESS ...
Hoping I could simply find references to the missing functions. Otherwise, please advice on how to achieve the second option. Regards.
It turns out zlib is already part of Android NDK. All that was needed was -lz flag:
LOCAL_LDLIBS += -lz
I have followed the instructions on http://doc.qt.nokia.com/stable/sql-driver.html#qibase for compiling Interbase support into Qt, and made sure all of my libraries are in the right place. qmake runs successfully, but when I run nmake, I get a series of undefined reference errors in qsql_ibase.cpp. If I open up the .pro in Qt Creator and hover over one of the functions that is throwing the undefined reference errors and follow the symbol (F2), it takes me to the ibase.h file where it is declared. Is it throwing the undefined reference errors because there is no function definition? If that is the case, why isn't it giving me any errors about a missing library?
Output example:
Creating library file: debug\libqsqlibased4.a
debug/qsql_ibase.o: In function getIBaseError':
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:80: undefined reference toisc_sqlcode'
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:85: undefined reference to isc_interprete'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:406: undefined reference toisc_dsql_free_st
atement'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:421: undefined reference to isc_create_blob2
'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:427: undefined reference toisc_put_segment'
This continues for many more errors, all undefined references.
That really sounds like the first issue mentioned under the "Troubleshooting" section of the page to which you link above:
You should always use client libraries that have been compiled with
the same compiler as you are using for your project. If you cannot get
a source distibution to compile the client libraries yourself, you
must make sure that the pre-compiled library is compatible with your
compiler, otherwise you will get a lot of "undefined symbols" errors.
Some compilers have tools to convert libraries, e.g. Borland ships the
tool COFF2OMF.EXE to convert libraries that have been generated with
Microsoft Visual C++.
Which compiler are you using to compile Qt, and where did you get the Interbase libraries? You also need to make sure those libraries can be found at link time. If you look at the output of your compiler, it should show you all the link directories in which it is searching (in addition to any globally defined, like PATH in Windows.) If the folder with your Interbase library is listed, it is probably that the compiler versions aren't matching.
Sorry for raising so old theme, but I found a solution and want to share with it. The problem is that macro ISC_EXPORT was not defined in Interbase's SDK due to conditional compilation defines. See details here - Howto build Interbase plugin for Qt by MinGW