Results 1 to 6 of 6

Thread: different method signatures for mingw and visual c

  1. #1
    Join Date
    Jan 2013
    Posts
    25
    Thanks
    2
    Platforms
    Windows

    Default different method signatures for mingw and visual c

    I am writing code to be compiled with both MinGW and Visual C compiler. I am using define like this:

    I have defined VISUAL_STUDIO In my project file as follows:
    Qt Code:
    1. QMAKE_CFLAGS_DEBUG += -O2 VISUAL_STUDIO
    2. QMAKE_CFLAGS += -O2 -DVISUAL_STUDIO
    To copy to clipboard, switch view to plain text mode 

    I get multiple definition error for the following code

    Qt Code:
    1. #ifdef VISUAL_STUDIO
    2. int FUNCA(
    3. #else
    4. static inline int FUNCA(
    5. #endif
    6. Pkt_t *pkt
    7. )
    To copy to clipboard, switch view to plain text mode 

    Can anybody help me with this or any idea to do it in different was will be appreciated?

  2. #2
    Join Date
    Jan 2013
    Posts
    25
    Thanks
    2
    Platforms
    Windows

    Default different method signatures for mingw and visual c

    I am writing code in QT that can be compiled with both MinGW and Visual C compiler. I am using define like this:

    I have defined VISUAL_STUDIO In my project file as follows:
    Qt Code:
    1. QMAKE_CFLAGS_DEBUG += -O2 VISUAL_STUDIO
    2. QMAKE_CFLAGS += -O2 -DVISUAL_STUDIO
    To copy to clipboard, switch view to plain text mode 

    I get multiple definition error for the following code

    Qt Code:
    1. #ifdef VISUAL_STUDIO
    2. int FUNCA(
    3. #else
    4. static inline int FUNCA(
    5. #endif
    6. Pkt_t *pkt
    7. )
    To copy to clipboard, switch view to plain text mode 

    Can anybody help me with this or any idea to do it in different was will be appreciated?

  3. #3
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: different method signatures for mingw and visual c

    why do you have -D in one, but not the other?

    also, maybe you're just including the file too many times... It's hard to tell without a complete compilable example - see my sig.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

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

    Default Re: different method signatures for mingw and visual c

    You get a multiple definition of which symbol exactly? Are you sure this is caused by your defines and not a non-inlined function declaration in line #2?
    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,553
    Thanks
    13
    Thanked 1,580 Times in 1,509 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: different method signatures for mingw and visual c

    You might want to read what the OP has already been told:
    http://qt-project.org/forums/viewthread/31971/

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: different method signatures for mingw and visual c

    Quote Originally Posted by ChrisW67 View Post
    You might want to read what the OP has already been told:
    http://qt-project.org/forums/viewthread/31971/
    Merged the threads, thanks.

Similar Threads

  1. Replies: 7
    Last Post: 18th April 2013, 23:39
  2. qt + mingw + visual studio header files
    By smoon in forum Installation and Deployment
    Replies: 5
    Last Post: 10th March 2011, 22:16
  3. MingW x Visual Studio compiler
    By john_god in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd September 2008, 18:06
  4. Qt with MinGw & Visual Studio
    By zhehongwang in forum Newbie
    Replies: 3
    Last Post: 30th August 2007, 22:49
  5. Replies: 7
    Last Post: 24th March 2007, 14:53

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.