PDA

View Full Version : Qt emit keyword duplicate



mreyfout
19th October 2010, 19:18
emit keyword conflict.
I am building an application using Qt and a Dynamic library, but it seems the dynamic library has a function name emit.

Function signature as as follows:
128 std::string emit (
129 double prep,
130 std::string tag,
131 int d1, int d2, int d3
132 ){ ..... }

I included the headers to the dynamic library in my .pri file as
QMAKE_CXXFLAGS = -isystem/home/math/include

I generated my makfile using: qmake myPrj.pro myPrj.pri
in myPrj.pro is an 'include(myPrj.pri)'

When I make I get the following error:
line 132 error: invalid use of ::

I have built numerous non-Qt projects using this dynamic library, in the past, no errors were ever encountered.

Is it possible to have qmake ignore the emit keywords when including this library?


Thanks,
Mr. eyfout.

wysota
19th October 2010, 20:10
Add CONFIG+=no_keywords to your project file and replace all occurences of "slots", "signals" and "emit" with "Q_SLOTS", "Q_SIGNALS" and "Q_EMIT" respectively in all your files. Remember to rerun qmake.

borisbn
20th October 2010, 05:10
Or you can write a simple wrapper for this dll, that doesn't use Qt, e.g. export function my_emit, that internally calls dll's emit function