簡體   English   中英

Qt 4.8.5和MinGW / GCC 4.8.1的問題

[英]Problems with Qt 4.8.5 and MinGW/GCC 4.8.1

我剛剛在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應用程序。 啟動后,出現錯誤消息:“程序意外完成。” 調試在進入qatomic_i386.h文件的QBasicAtomicInt :: deref()成員函數的main()之前,我遇到了分段錯誤。
如果我構建基於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?

這三個問題相互依賴嗎?

您如何“安裝” Qt? 在您的情況下,“安裝”它的唯一方法是從源代碼構建它。 通常,您需要使用與編譯使用Qt的項目相同的編譯器來編譯Qt。 某些C ++編譯器版本不匹配可能會起作用,但您剛剛表明組合不起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM