我是使用VS2019+QT2.15.2+QGIS 3.16.0编译运行的,其中出现了较多的问题,在此记录一下,避免其他人入坑。
1.random_shuffle()一直显示未找到标识符
解决方法:这是由于C++ 17中,该标识符已经被移除,可将环境改为C++ 17以下。
如果使用C++ 17的话,可以找到出错的位置,将源代码修改一下:
将
std::random_shuffle( mPrecalculatedColors.begin(), mPrecalculatedColors.end() );
改为
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(mPrecalculatedColors.begin(), mPrecalculatedColors.end(),g);
2.QGIS通过CMAKE编译后用VS2019生成没问题,一旦运行就会出现下面的问题。
Error loading QGIS
Oops, looks like an error loading Qgis, Details Could not load qgis_app.dll.
Window Erro: The specified procedure could not be found.
Help: Check c:\OS… qgis-bin.env for correct environmental paths.
解决方法:将OSGeo4W的dll、OSGeo4W\apps\qgis\bin下的dll和qt5下的dll文件都拷到同级exe目录下,编译后的exe文件位于
F:\OSGeo4WQGIS\qgis-latest-ltr\qgis-3.16.10\build\output\bin\Release
3.启动qgis.exe 会出现下面的问题:
解决方法:将OSGeo4W64\apps\Qt5\plugins文件夹拷贝到exe执行目录下,即问题2中的路径当中。
暂时写这么多,想起来了再继续补充…