[Qt-interest] Q_OBJECT in DLL - Release build warnings
Catalin Roman
katalin.roman at gmail.com
Wed Feb 10 10:11:08 CET 2010
Sorry for my delayed answer.
I'm using Qt Creator only, no VS compiler.
Your example works fine for me and I thank you for taking the time to write
it.
But ... I have attached a CounterFooBar example(which is closer from the
layout/deployment point of view my actual project) which gives me the
warnings (Qt 4.6.0, Qt Creator 1.3.0, mingw32 compiler). I'm very curios if,
with your settings, you get the same warnings(maybe I should mention that I
always do "Clean" before "Build").
Thanks again. I'm looking forward to your reply :).
On Tue, Feb 9, 2010 at 11:04 AM, <Oliver.Knoll at comit.ch> wrote:
> Catalin Roman wrote on Monday, February 08, 2010 1:55 PM:
>
> > Hello again,
> > Unfortunately with the same problem, but now it appears in both
> > Debug/Release build modes. As I stated earlier, all my defines are in
> > place:
> > in foo.pro:
> > DEFINES += FOO_LIBRARY
> >
> > in foo_global.h:
> > #if defined(FOO_LIBRARY)
> > # define FOOSHARED_EXPORT Q_DECL_EXPORT #else # define
> > FOOSHARED_EXPORT Q_DECL_IMPORT #endif
> >
> > in foo.h:
> > class FOOSHARED_EXPORT myClass : public QObject{ Q_OBJECT;
> > public:
> > ...
> > }
> >
> > Is it possible that I'm missing some other Qt Creator setting? If so,
> > which one?
>
> Your code snippet looks okay to me. Maybe there are some project settings
> in your Qt Creator environment which are wrong.
>
> But just for my understanding, you are using Qt Creator + Visual Studio
> compiler, is that correct? Otherwise you wouldn't get these compiler
> warnings (this __declspec(dllexport/import) is a Visual Studio compiler
> thing only, I believe).
>
> I have attached a small example: a library 'Foo' which exports certain
> methods only (as explained in my 2nd approach in my previous post) and an
> executable "Bar" which calls a method in 'Foo'. It also connects to some
> signal in 'Foo', as to show that the Q_OBJECT etc. generated code really
> works.
>
> In the toplevel directory either do a
>
> - qmake && mingw32-make (for the MinGW32 version) or
> - open the Visual Studio solution *.sln (VS 2005 and above)
>
> With Qt 4.6.0 (MinGW32 Qt SDK binary build) and Qt 4.6.1 (compiled with
> Visual Studio 2005 Express from source) it compiles fine without warnings
> (both MinGW32 gcc and Visual Studio 2005 Express compiler), as expected.
> Does it work for you? If so, "compare the settings" and apply the changes to
> your project ;)
>
> Cheers, Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100210/7bf6f7be/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CounterFooBar.zip
Type: application/zip
Size: 548595 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100210/7bf6f7be/attachment.zip
More information about the Qt-interest-old
mailing list