June 10, 2011

bluenoise bluenoise
Lab Rat
2 posts

How to disable qmake addition of -DUNICODE compiler flag

 

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

4 replies

June 10, 2011

Franzk Franzk
Lab Rat
830 posts

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.

 Signature 

“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

June 11, 2011

bluenoise bluenoise
Lab Rat
2 posts

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…

June 14, 2011

ppkt ppkt
Ant Farmer
1 posts

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

June 14, 2011

Franzk Franzk
Lab Rat
830 posts

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).

 Signature 

“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

 
  ‹‹ stylesheet for qcombobox      Possible to capture all the tcp packages sent from my computer? ››

You must log in to post a reply. Not a member yet? Register here!