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

cmake: no wWinMain when compiling as unicode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.x, 5.3.1, 5.4.1
    • QPA: Windows
    • None

    Description

      I trying to compile correct unicode application. For this I use UNICODE and _UNICODE defines and -municode linker flag. Building fails with error: undefined reference to `wWinMain@16'

      Full compilation output:

      [taurus@lix build]$ mingw32-cmake -DCMAKE_BUILD_TYPE=Release ..
      -- The C compiler identification is GNU 4.8.4
      -- The CXX compiler identification is GNU 4.8.4
      -- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
      -- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++
      -- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++ -- works
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Configuring done
      -- Generating done
      CMake Warning:
        Manually-specified variables were not used by the project:
      
          CMAKE_INSTALL_LIBDIR
          INCLUDE_INSTALL_DIR
          SHARE_INSTALL_PREFIX
          SYSCONF_INSTALL_DIR
      
      
      -- Build files have been written to: /home/taurus/develop/unicode-test/build
      [taurus@lix build]$ make VERBOSE=1
      /usr/bin/cmake -H/home/taurus/develop/unicode-test -B/home/taurus/develop/unicode-test/build --check-build-system CMakeFiles/Makefile.cmake 0
      /usr/bin/cmake -E cmake_progress_start /home/taurus/develop/unicode-test/build/CMakeFiles /home/taurus/develop/unicode-test/build/CMakeFiles/progress.marks
      make -f CMakeFiles/Makefile2 all
      make[1]: Entering directory `/home/taurus/develop/unicode-test/build'
      make -f CMakeFiles/unicode-test.dir/build.make CMakeFiles/unicode-test.dir/depend
      make[2]: Entering directory `/home/taurus/develop/unicode-test/build'
      cd /home/taurus/develop/unicode-test/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/taurus/develop/unicode-test /home/taurus/develop/unicode-test /home/taurus/develop/unicode-test/build /home/taurus/develop/unicode-test/build /home/taurus/develop/unicode-test/build/CMakeFiles/unicode-test.dir/DependInfo.cmake --color=
      Dependee "/home/taurus/develop/unicode-test/build/CMakeFiles/unicode-test.dir/DependInfo.cmake" is newer than depender "/home/taurus/develop/unicode-test/build/CMakeFiles/unicode-test.dir/depend.internal".
      Dependee "/home/taurus/develop/unicode-test/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/taurus/develop/unicode-test/build/CMakeFiles/unicode-test.dir/depend.internal".
      Scanning dependencies of target unicode-test
      make[2]: Leaving directory `/home/taurus/develop/unicode-test/build'
      make -f CMakeFiles/unicode-test.dir/build.make CMakeFiles/unicode-test.dir/build
      make[2]: Entering directory `/home/taurus/develop/unicode-test/build'
      /usr/bin/cmake -E cmake_progress_report /home/taurus/develop/unicode-test/build/CMakeFiles 1
      [100%] Building CXX object CMakeFiles/unicode-test.dir/main.cpp.obj
      /usr/bin/i686-w64-mingw32-g++   -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUNICODE -D_UNICODE -O3 -DNDEBUG @CMakeFiles/unicode-test.dir/includes_CXX.rsp   -o CMakeFiles/unicode-test.dir/main.cpp.obj -c /home/taurus/develop/unicode-test/main.cpp
      Linking CXX executable unicode-test.exe
      /usr/bin/cmake -E cmake_link_script CMakeFiles/unicode-test.dir/link.txt --verbose=1
      /usr/bin/cmake -E remove -f CMakeFiles/unicode-test.dir/objects.a
      /usr/bin/i686-w64-mingw32-ar cr CMakeFiles/unicode-test.dir/objects.a @CMakeFiles/unicode-test.dir/objects1.rsp
      /usr/bin/i686-w64-mingw32-g++  -O3 -DNDEBUG    -mwindows -Wl,--whole-archive CMakeFiles/unicode-test.dir/objects.a -Wl,--no-whole-archive  -o unicode-test.exe -Wl,--out-implib,libunicode-test.dll.a -Wl,--major-image-version,0,--minor-image-version,0  /usr/i686-w64-mingw32/sys-root/mingw/lib/libQt5Core.dll.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libQt5Gui.dll.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libQt5Widgets.dll.a -municode /usr/i686-w64-mingw32/sys-root/mingw/lib/libQt5Gui.dll.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libQt5Core.dll.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libqt5main.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
      /usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_w.o):(.text+0x29): undefined reference to `wWinMain@16'
      collect2: error: ld returned 1 exit status
      make[2]: *** [unicode-test.exe] Error 1
      make[2]: Leaving directory `/home/taurus/develop/unicode-test/build'
      make[1]: *** [CMakeFiles/unicode-test.dir/all] Error 2
      make[1]: Leaving directory `/home/taurus/develop/unicode-test/build'
      make: *** [all] Error 2
      

      I looked at Qt 4 and 5 sources. Seems no wWinMain function. Only WinMain.

      In attachments full test case to reproduce a problem. It is cmake project with some specific options.
      ENABLE_UNICODE - enable/disable unicode variant. By default ON.
      QT5_BUILD - Qt5 or Qt4 building. By default ON.

      Attachments

        1. unicode-test.tar.gz
          0.7 kB
          Ivan Romanov

        Issue Links

          Activity

            People

              kleint Friedemann Kleint
              taurus Ivan Romanov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: