Hi ESRI, I have tried to build an ArcGIS qt application with cmake command , I have successfully compiled the project and link it, but after I have received some messages that my computer couldn't find some ArcGIS qml libraries. How can I fix it? Cmake example and the errors below!
Some code from main.cpp :
QString arcGISRuntimeImportPath;
QString arcGISToolkitImportPath;
#if defined(LINUX_PLATFORM_REPLACEMENT)
// on some linux platforms the string 'linux' is replaced with 1
// fix the replacement paths which were created
arcGISRuntimeImportPath = "../For_the_map/qt100.1/sdk/linux/x64/qml";
arcGISToolkitImportPath = "../For_the_map/qt100.1/sdk/toolkit/Import";
#endif
// Add the Runtime and Extras path
view.engine()->addImportPath(arcGISRuntimeImportPath);
// Add the Toolkit path
view.engine()->addImportPath(arcGISToolkitImportPath);
// Set the source
view.setSource(QUrl("../For_the_map/Simple_Renderer/Simple_Renderer.qml"));
There are the messages:
file:///home/asus/Desktop/For_the_map/Simple_Renderer/Simple_Renderer.qml:20:1: module "Esri.ArcGISRuntime.Toolkit.Controls" is not installed
import Esri.ArcGISRuntime.Toolkit.Controls 100.1
^
file:///home/asus/Desktop/For_the_map/Simple_Renderer/Simple_Renderer.qml:21:1: module "Esri.ArcGISExtras" is not installed
import Esri.ArcGISExtras 1.1
^
file:///home/asus/Desktop/For_the_map/Simple_Renderer/Simple_Renderer.qml:20:1: module "Esri.ArcGISRuntime.Toolkit.Controls" is not installed
import Esri.ArcGISRuntime.Toolkit.Controls 100.1
^
file:///home/asus/Desktop/For_the_map/Simple_Renderer/Simple_Renderer.qml:21:1: module "Esri.ArcGISExtras" is not installed
import Esri.ArcGISExtras 1.1
Solved! Go to Solution.
Hi George, are you running on linux?
I think that "LINUX_PLATFORM_REPLACEMENT" may not be defined in your project if you are building with cmake. We set this in one of our .pri files which is used by qmake/qtcreator and I am not 100% sure that will be used by your cmake project.
It's probably worth adding some print statements so that you can confirm the import paths are correct (e.g. arcGISRuntimeImportPath and arcGISToolkitImportPath).
You can also set the environment variable "QML_IMPORT_TRACE
" (see Import Statements | Qt QML 5.10 ) to try and debug what is going on.
I hope that helps,
Luke
Hi George, are you running on linux?
I think that "LINUX_PLATFORM_REPLACEMENT" may not be defined in your project if you are building with cmake. We set this in one of our .pri files which is used by qmake/qtcreator and I am not 100% sure that will be used by your cmake project.
It's probably worth adding some print statements so that you can confirm the import paths are correct (e.g. arcGISRuntimeImportPath and arcGISToolkitImportPath).
You can also set the environment variable "QML_IMPORT_TRACE
" (see Import Statements | Qt QML 5.10 ) to try and debug what is going on.
I hope that helps,
Luke
Thank you, I add this lines to my cmake, I build everything!
Hi George, could you please kindly share your example cmake file. I'm trying to do something similar using cmake and visual studio code but I can't get it to compile
Hi Daniel, we are now shipping CMake templates with 100.8.
If you need something quick and dirty right now though, this might put you in the right direction:
Thanks Neil, that was very helpful.