Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115229

Qt 6.5.1 MSVC 2019 fails to compile QtMqtt because of Chinese text encoding

    XMLWordPrintable

Details

    • Windows
    • 1
    • 7a1625abf (dev), 29d5c90ba (6.5), 8d4945fb6 (6.6)
    • Foundation Sprint 86

    Description

      I'm working to build an example project in QtMqtt.

      I modify some code in "CMakeLists.txt" to make it work:

      add_subdirectory(${CMAKE_SOURCE_DIR}/qtmqtt)
      include_directories(${CMAKE_SOURCE_DIR}/qtmqtt/src/mqtt) 

      Here is the source code:

       https://1drv.ms/u/s!Aq1IV3OPt1GHnW3PSo_ZvvfXYyke?e=Z7NFTZ

       

      When I compile it using "Desktop Qt 6.5.1 MinGW 64-bit", all things work well.

      But when I turn to "Desktop Qt 6.5.1 MSVC 2019 64 bit", it shows a lot of errors when compiling:

      dummy.cpp
      
      E:/Qt/6.5.1/msvc2019_64/include\QtCore/qtcoreexports.h(1): error C2220:
      以下警告被视为错误
      
      E:/Qt/6.5.1/msvc2019_64/include\QtCore/qtcoreexports.h(1): warning C4819:
      该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为
      Unicode 格式以防止数据丢失 

      In English it is:

      dummy.cpp
      
      E:/Qt/6.5.1/msvc2019_64/include\QtCore/qtcoreexports.h(1): error C2220:
      the following warning is treated as an error
      
      E:/Qt/6.5.1/msvc2019_64/include\QtCore/qtcoreexports.h(1): warning C4819:
      The file contains a character that cannot be represented in the current code page (936).
      Save the file in Unicode format to prevent data loss 

       

      Then I change my Windows language to English, and succeed to compile and run. Open the option "Beta Unicode UTF-8" in Windows settings also works. But it is inconvenient for me to use a English Windows, and some program's text become unreadable when opening the option "Beta Unicode UTF-8" in Windows settings. So I continue to find other solutions.

       

      Then I install "Qt 6.2.4 MSVC 2019" and put "QtMqtt 6.2.4" in the project, compile it and run, all things work well. (I didn't test other Qt version.)

      Therefore, I wonder if something go wrong with the official pre-built "Qt 6.5.1 MSVC 2019", so I download a third party built "Qt 6.5.1 MSVC 2019", link it to Qt Creator, and start to compile, all things work well!

      The third party built Qt:
      https://build-qt.fsu0413.me/6.5-series/6.5.1-for-windows/index.html

      In conclusion, either the official built Qt or QtMqtt make some mistake.

      If you want to reproduce the problem, you can download the project's source code and the third party built Qt. By the way, the third party built Qt doesn't have "Debug", you can use it with "RelWithDebInfo" or others.

      Attachments

        1. untitled999.zip
          301 kB
        2. test123.zip
          619 kB
        3. 2.png
          2.png
          160 kB
        4. 1.png
          1.png
          151 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mmutz Marc Mutz
            roachlin Lin Lin
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes