Qt 4.8.5和MinGW / GCC 4.8.1的问题

时间:2013-09-12 10:44:08

标签: qt qt4 mingw qt-creator

我刚刚在Windows 7上彻底安装了以下工具:

  • MinGW / GCC 4.8.1
  • Qt 4.8.5
  • Qt Creator 2.8.1

在PATH中有:C:\Qt\4.8.5\bin;C:\Qt\4.8.5\include;C:\Qt\4.8.5\lib;C:\MinGW\bin;

1)我读到有关Qt 4.8需要GCC 4.6这一事实的警告。我使用GCC 4.8.1忽略了它。所以这可能是一个问题。

2)我成功安装了Qt Creator。我成功构建了默认的Qt GUI应用程序。启动时,我收到错误:“该程序意外完成。”调试我在进入main()之前,在qatomic_i386.h文件中,在QBasicAtomicInt :: deref()成员函数中得到了分段错误。
如果我构建一个基于cmake的控制台应用程序,一切都很好。

3)如果我构建一个以前基于Qt cmake的项目(来自命令行或来自Qt Creator),这就是我得到的(在树构建之外):

我第一次运行cmake:

MyPrj-build>cmake -G "MinGW Makefiles"  ..\MyPrj
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:20 (message):
  sh.exe was found in your PATH, here:

  C:/Program Files (x86)/Git/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:6 (PROJECT)

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:S:/MyPrj/MyPrj-build/CMakeFiles/2.8.11.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:S:/MyPrj/MyPrj-build/CMakeFiles/2.8.11.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

第二次:

S:\MyPrj\MyPrj-build>cmake -G "MinGW Makefiles"  ..\MyPrj
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1382 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  CMakeLists.txt:12 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred!  

在第一次和第二次cmake运行中有这些不同的行为是否正常?

为什么系统找不到Qt4?

这三个问题是否相互依赖?

1 个答案:

答案 0 :(得分:1)

你是如何“安装”你的Qt的?在您的情况下“安装”它的唯一方法是从源代码构建它。通常,在编译Qt-using项目时,需要使用相同的编译器来编译Qt。某些C ++编译器版本不匹配可能会起作用,但您只是表明您的组合没有。