Results 1 to 5 of 5

Thread: Linking Qt in a dynamic library

  1. #1
    Join Date
    Jul 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Arrow Linking Qt in a dynamic library

    Hi, I have a dynamic library that works fine, and I would like to use a QObject in it. After including the "qobject.h" header, I compile adn evrything is fine. But when I try declaring a QObject, the compiler always gives me a "identifier not found" error. I tried foward eclaration of the QObject class, it did not help. It's weird because visual studio's intellisense is working when I use Qt in my dll (ex.: when i declare a QObject, visual sdio shows me the functions available to my QObject). Is there anything special I have to do to use Qt in a dynamic library? Do I have to compile it with qmake now that I'm using a QObject?

    thanks for the help

    Dave

  2. #2
    Join Date
    Apr 2009
    Posts
    21
    Thanked 3 Times in 2 Posts

    Default Re: Linking Qt in a dynamic library

    you should use

    Qt Code:
    1. #include <QObject>
    To copy to clipboard, switch view to plain text mode 
    Welcome to My Chinese Qt Blog (Google Translate Integrated) - http://www.xlrw.co.cc
    Dedicated to make Qt popular in Chinese-speaking society.

  3. #3
    Join Date
    Jul 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linking Qt in a dynamic library

    Quote Originally Posted by freezeblue View Post
    you should use

    Qt Code:
    1. #include <QObject>
    To copy to clipboard, switch view to plain text mode 
    thx, but I tried, gives me the same errors...


    EDIT: the problems seems only to occur after I include stdafx.h. If I try to include the Qt headers after Stdafx.h, my library fails to compile, giving me syntax errors. If I use a Qt reference before including Stdafx.h, it compiles and runs fine.
    Last edited by dave_mm0; 18th July 2009 at 17:06.

  4. #4
    Join Date
    Apr 2009
    Posts
    21
    Thanked 3 Times in 2 Posts

    Default Re: Linking Qt in a dynamic library

    Can you post the full compile output messages?
    Welcome to My Chinese Qt Blog (Google Translate Integrated) - http://www.xlrw.co.cc
    Dedicated to make Qt popular in Chinese-speaking society.

  5. #5
    Join Date
    Jul 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linking Qt in a dynamic library

    Quote Originally Posted by freezeblue View Post
    Can you post the full compile output messages?
    sure, here it is

    Qt Code:
    1. 1>c:\users\dave\documents\visual studio 2008\projects\frogger\froggerdll\ftclient.cpp(47) : error C2653: 'QWidget' : is not a class or namespace name
    2. 1>c:\users\dave\documents\visual studio 2008\projects\frogger\froggerdll\ftclient.cpp(47) : error C3861: 'find': identifier not found
    To copy to clipboard, switch view to plain text mode 

    the line in question is QWidget::find(hwnd);
    and I am including <QWidget>

Similar Threads

  1. Trouble linking static library
    By russdot in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2009, 11:56
  2. Replies: 1
    Last Post: 5th March 2007, 21:50
  3. dynamic linking on mac
    By munna in forum General Discussion
    Replies: 4
    Last Post: 1st January 2007, 19:39
  4. linking qt3 to a library
    By thebra in forum Newbie
    Replies: 10
    Last Post: 11th November 2006, 02:25
  5. import library linking
    By bruce1007 in forum Qt Programming
    Replies: 6
    Last Post: 19th May 2006, 11:27

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.