嗨,我是 qt 和 CMake 的新手,这可能是一个简单的解决方法,但我整天都在努力解决它。
我正在尝试在 Qt 项目中使用GeographicLib 。我安装了 CMake 并从https://geographiclib.sourceforge.io/html/intro.html下载了文件。在 Geographiclib 网站上,有一个构建用于 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.
该网站说,如果 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" ..
我正在使用 Desktop 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 的顶级目录运行后,出现以下错误:
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。
谢谢你的耐心!
问候库斯