PDA

View Full Version : different method signatures for mingw and visual c



tesmai4
30th August 2013, 15:26
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:

QMAKE_CFLAGS_DEBUG += -O2 VISUAL_STUDIO
QMAKE_CFLAGS += -O2 -DVISUAL_STUDIO

I get multiple definition error for the following code



#ifdef VISUAL_STUDIO
int FUNCA(
#else
static inline int FUNCA(
#endif
Pkt_t *pkt
)


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

tesmai4
30th August 2013, 15:28
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:


QMAKE_CFLAGS_DEBUG += -O2 VISUAL_STUDIO
QMAKE_CFLAGS += -O2 -DVISUAL_STUDIO


I get multiple definition error for the following code



#ifdef VISUAL_STUDIO
int FUNCA(
#else
static inline int FUNCA(
#endif
Pkt_t *pkt
)


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

amleto
30th August 2013, 19:23
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.

wysota
2nd September 2013, 23:07
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?

ChrisW67
3rd September 2013, 00:20
You might want to read what the OP has already been told:
http://qt-project.org/forums/viewthread/31971/

anda_skoa
3rd September 2013, 09:04
You might want to read what the OP has already been told:
http://qt-project.org/forums/viewthread/31971/

Merged the threads, thanks.