Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to disable qmake addition of -DUNICODE compiler flag
Forum Updated to NodeBB v4.3 + New Features

How to disable qmake addition of -DUNICODE compiler flag

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 14.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bluenoise
    wrote on last edited by
    #1

    Hi for a project I'm working on in Qt creator I need to be able to dissable the -DUNICODE compiler flag added by qmake and replace it with a flag for MBCS.

    I do understand there may be issues with 3rd party libs by disabling unicode however I NEED to do this to use another 3rd party lib.

    How would I go about doing this? I have figured out how to add compiler flags with the QMAKE_CXX option but I can't find anything about disabling the ones that qmake adds?

    Thank you

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      You would have to change the qmake.conf in the makespecs. It's a nasty trick and will probably cause conflicts.

      However, you should always be able to specify whether you want to use the wchar_t or char version, regardless of the UNICODE macro.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bluenoise
        wrote on last edited by
        #3

        Thanks!
        That helped alot! Exactley what I was looking for.

        unfortunatley I can't specify the string type because it's output from one 3rd party function whose type is specified by the compiler to a second 3rd party function that only accepts a particular type. I guess I could write a conversion script buy that's not what I'm looking for...

        1 Reply Last reply
        0
        • P Offline
          P Offline
          ppkt
          wrote on last edited by
          #4

          I had the same problem, but I think simpler solution is to add following line:
          DEFINES -= UNICODE
          to your .pro file.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Franzk
            wrote on last edited by
            #5

            Much cleaner indeed. This does mean you have to add it to every project though (or have a .pri file where you store such settings if they're common).

            "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved