Qt中如何使用GeographicLib
How to use GeographicLib in Qt
嗨,我是 qt 和 CMake 的新手,这可能是一个简单的修复,但我一整天都在努力解决这个问题。
我正在尝试使用 GeographicLib in a Qt project. I instaled CMake and downloaded the files from https://geographiclib.sourceforge.io/html/intro.html. On the Geographiclib website there is a guide for Building the library for use with Qt。您必须执行几个命令 运行 :
export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
mkdir BUILD
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
在 运行 上面我得到以下内容:
C:\Users\koos> export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos> mkdir BUILD
A subdirectory or file BUILD already exists.
C:\Users\koos> cd BUILD
C:\Users\koos\BUILD> cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
CMake Error: The source directory "C:/Users/koos" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
the website 说如果 cmake 抱怨你必须 运行 以下内容:
env PATH="$( echo $PATH | tr : '\n' |
while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
sed 's/:$//' )" \
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
然后我得到:
C:\Users\koos\BUILD> env PATH="$( echo $PATH | tr : '\n' |
'env' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos\BUILD> while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
The syntax of the command is incorrect.
C:\Users\koos\BUILD> sed 's/:$//' )" \
'sed' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos\BUILD> cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
我正在使用桌面 Qt 13.0 MinGw 64 位。我认为以下内容有问题:“"mingw32-make"”
(是 32 而不是 64,但我尝试更改它但无处可去)。有人可以向我解释一下我应该如何在 Qt 中安装 Geographic lib 库吗(也许如何使用 cmake qui 来完成任务,因为我对 cmake 了解不多)
编辑:
所以我安装了 cygwin,现在它给了我以下信息:
koos@computer ~
$ mkdir BUILD
export PATH="`cygpath -m C:\Qt\Tools\mingw730_64\bin`:$PATH"
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
mingw32-make
mingw32-make install
koos@computer ~
$ mkdir BUILD
koos@computer ~
$ cd BUILD
koos@computer ~/BUILD
$ cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
CMake Error: The source directory "C:/cygwin64/home/koos" does not appear
to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
koos@computer ~/BUILD
$ mingw32-make
-bash: mingw32-make: command not found
koos@computer ~/BUILD
$ mingw32-make install
-bash: mingw32-make: command not found
从 GeographicLib 的顶级目录 运行ning 后,我得到以下错误:
CMake Error: CMake was unable to find a build program corresponding to
"MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to
select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to
"MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to
select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
路径 C:\Qt\Tools\mingw730_64\bin
确实包含 mingw32-make。
感谢您的耐心等待!
问候
库斯
来自 GeographicLib 站点的 instructions 对 运行 使用 Cygwin 的命令说:
If you are using the mingw compiler on Windows for Qt, then you need to build GeographicLib with mingw. You can accomplish this with cmake under cygwin with, for example, ...
export
、env
和 sed
等命令不是 Windows 的原生命令,而是 Linux 命令。在 Cygwin 命令提示符中,这些必须是 运行。你的问题在你的设置中没有提到 Cygwin,所以我猜你要么没有安装它,要么没有使用它。尝试为您的计算机安装 Cygwin 并从 Cygwin 命令提示符中 运行 使用列出的命令。
这些说明假定您正在 运行从 GeographicLib 包的 顶级 目录执行命令,因此您必须先导航到该目录。更新后的命令看起来像这样:
cd C:/path/to/your/GeographicLib
export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
mkdir BUILD
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
在 Cygwin 中键入以下命令对我有用:
set CC=C:/Qt/Tools/mingw730_64/bin/x86_64-w64-mingw32-gcc
set CXX=C:/Qt/Tools/mingw730_64/bin/x86_64-w64-mingw32-g++
cd C:/path/to/my/GeographicLib
rm -rf BUILD; mkdir BUILD; cd BUILD
export PATH="`cygpath C:/Qt/Tools/mingw730_64/bin`:$PATH"
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
env PATH="$( echo $PATH | tr : '\n' |
while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
sed 's/:$//' )" \
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
cygstart --action=runas mingw32-make install
注意:确保你安装了 Cmake,你可以下载 windows here. Do not install the cygwin version of cmake because it does not have the MinGW Makefiles generator and make sure to check the "Add to system PATH" checkbox in the cmake installer. When installing cygwin 的安装程序,确保 select "make"(gnu 版本的 make实用程序)包。
嗨,我是 qt 和 CMake 的新手,这可能是一个简单的修复,但我一整天都在努力解决这个问题。
我正在尝试使用 GeographicLib in a Qt project. I instaled CMake and downloaded the files from https://geographiclib.sourceforge.io/html/intro.html. On the Geographiclib website there is a guide for Building the library for use with Qt。您必须执行几个命令 运行 :
export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
mkdir BUILD
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
在 运行 上面我得到以下内容:
C:\Users\koos> export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos> mkdir BUILD
A subdirectory or file BUILD already exists.
C:\Users\koos> cd BUILD
C:\Users\koos\BUILD> cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
CMake Error: The source directory "C:/Users/koos" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
the website 说如果 cmake 抱怨你必须 运行 以下内容:
env PATH="$( echo $PATH | tr : '\n' |
while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
sed 's/:$//' )" \
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
然后我得到:
C:\Users\koos\BUILD> env PATH="$( echo $PATH | tr : '\n' |
'env' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos\BUILD> while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
The syntax of the command is incorrect.
C:\Users\koos\BUILD> sed 's/:$//' )" \
'sed' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\koos\BUILD> cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
我正在使用桌面 Qt 13.0 MinGw 64 位。我认为以下内容有问题:“"mingw32-make"” (是 32 而不是 64,但我尝试更改它但无处可去)。有人可以向我解释一下我应该如何在 Qt 中安装 Geographic lib 库吗(也许如何使用 cmake qui 来完成任务,因为我对 cmake 了解不多)
编辑:
所以我安装了 cygwin,现在它给了我以下信息:
koos@computer ~
$ mkdir BUILD
export PATH="`cygpath -m C:\Qt\Tools\mingw730_64\bin`:$PATH"
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
mingw32-make
mingw32-make install
koos@computer ~
$ mkdir BUILD
koos@computer ~
$ cd BUILD
koos@computer ~/BUILD
$ cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program
Files/GeographicLib" ..
CMake Error: The source directory "C:/cygwin64/home/koos" does not appear
to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
koos@computer ~/BUILD
$ mingw32-make
-bash: mingw32-make: command not found
koos@computer ~/BUILD
$ mingw32-make install
-bash: mingw32-make: command not found
从 GeographicLib 的顶级目录 运行ning 后,我得到以下错误:
CMake Error: CMake was unable to find a build program corresponding to
"MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to
select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to
"MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to
select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
路径 C:\Qt\Tools\mingw730_64\bin
确实包含 mingw32-make。
感谢您的耐心等待!
问候 库斯
来自 GeographicLib 站点的 instructions 对 运行 使用 Cygwin 的命令说:
If you are using the mingw compiler on Windows for Qt, then you need to build GeographicLib with mingw. You can accomplish this with cmake under cygwin with, for example, ...
export
、env
和 sed
等命令不是 Windows 的原生命令,而是 Linux 命令。在 Cygwin 命令提示符中,这些必须是 运行。你的问题在你的设置中没有提到 Cygwin,所以我猜你要么没有安装它,要么没有使用它。尝试为您的计算机安装 Cygwin 并从 Cygwin 命令提示符中 运行 使用列出的命令。
这些说明假定您正在 运行从 GeographicLib 包的 顶级 目录执行命令,因此您必须先导航到该目录。更新后的命令看起来像这样:
cd C:/path/to/your/GeographicLib
export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
mkdir BUILD
cd BUILD
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
在 Cygwin 中键入以下命令对我有用:
set CC=C:/Qt/Tools/mingw730_64/bin/x86_64-w64-mingw32-gcc
set CXX=C:/Qt/Tools/mingw730_64/bin/x86_64-w64-mingw32-g++
cd C:/path/to/my/GeographicLib
rm -rf BUILD; mkdir BUILD; cd BUILD
export PATH="`cygpath C:/Qt/Tools/mingw730_64/bin`:$PATH"
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
mingw32-make install
env PATH="$( echo $PATH | tr : '\n' |
while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
sed 's/:$//' )" \
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
mingw32-make
cygstart --action=runas mingw32-make install
注意:确保你安装了 Cmake,你可以下载 windows here. Do not install the cygwin version of cmake because it does not have the MinGW Makefiles generator and make sure to check the "Add to system PATH" checkbox in the cmake installer. When installing cygwin 的安装程序,确保 select "make"(gnu 版本的 make实用程序)包。