Results 1 to 8 of 8

Thread: How to specify my own global typedefs

  1. #1
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt4

    Question How to specify my own global typedefs

    Hi, the qglobal.h file contains typedefs for all possible variable types like quint8 quint16 etc etc.
    I am trying to compile an application with slightly different typedefs like uint8_t uint16_t etc etc.

    Can anyone tell me what the proper way is to add these typedefs globally somewhere?

    Regards

    Gert

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to specify my own global typedefs

    These definitions are typically found in:
    Qt Code:
    1. // For C99
    2. #include <stdint.h>
    3. // For C++
    4. #include <cstdint>
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt4

    Default Re: How to specify my own global typedefs

    Forgot to mention that the files I am trying to compile are generated, so I can't modify them.
    An other compiler I am using has the ability to "force" an #include for every file that is being compiled. Is there maybe a similar setting here in Qt Creator? Or a way of adding project specific items in qglobal.h?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to specify my own global typedefs

    QtCreator is not a compiler. If you have a compiler you like, just try using it to build Qt applications.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to specify my own global typedefs

    What is generating this incomplete code?

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to specify my own global typedefs

    Qt Creator uses GCC by default, so all you need to do is pass the compiler command line option "-include file.h" to process file.h as if #include "file.h" appeared as the first line.

  7. #7
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt4

    Default Re: How to specify my own global typedefs

    Makes sense squidge, But my next question is where do I tell Qt Creator to use this "-include file.h" when calling the compiler.
    The place that makes sense is to pass this information on to the make or qmake, so I went to the Projects tab where you can add additional arguments to the QMake proces. But that does not work.

    Why is there a make and a qmake in that tab? I also noticed that you can swap the order of these two around???

    Any suggestions?

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to specify my own global typedefs

    What is generating the broken code in the first place? It would be preferable to get the generator producing code that is complete and compiles rather than rely on compiler specific hacks.

Similar Threads

  1. QML Global Object
    By coderbob in forum Qt Quick
    Replies: 1
    Last Post: 3rd November 2010, 13:18
  2. Overriding global new
    By branko in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2010, 16:10
  3. global variable
    By Shuchi Agrawal in forum General Programming
    Replies: 10
    Last Post: 15th February 2007, 04:19
  4. Qt and global variables
    By Morea in forum Qt Programming
    Replies: 11
    Last Post: 1st February 2007, 23:42
  5. Global variables
    By Mariane in forum Newbie
    Replies: 14
    Last Post: 10th October 2006, 17:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.