Results 1 to 5 of 5

Thread: Need help with compiling on Windows

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Need help with compiling on Windows

    Hello!

    I frequently change back and forth between Linux and Windows and check if my Qt app runs on both and looks the same. Recently I added an external library to my project (libQGLViewer). Because it requires to make modifications to the project file, which are different on Windows and on Linux, I decided to fully integrate the source code of the library into my project. So I just copied the libary sources into my source folder, cleaned it from any makefiles, added all the source and header files to the project file and tried to compile it using qmake and then make. It works great on Linux. But on Windows I get this error message:

    src\QGLViewer\qglviewer.cpp:80: error: definition of static data member 'QGLViewer::QGLViewerPool_' of dllimport'd class.

    I have no clue what this is trying to tell me. Can anyone please help me out?

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

    Default Re: Need help with compiling on Windows

    Making the project file work differently on different platforms is not a problem, just use scopes:

    qmake Code:
    1. win32:LIBS+=-L../mywindows/library/folder
    2. linux:LIBS+=-L../mylinux/library/folder
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to wysota for this useful post:

    Cruz (28th January 2009)

  4. #3
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Need help with compiling on Windows

    Hm, yes. That approach is probably a lot easier. A problem that still remains though is that the library has to be installed on every machine where the project is being developed.

    In any case, I would still like to understand what this compiler error is that I'm seeing. What does it mean by dllimported class?

    I can easily compile the project without the library in it. And I can also compile the library alone. What goes wrong when I copy the library sources into my sources? What's the next thing I should be taking a look at?

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

    Default Re: Need help with compiling on Windows

    Quote Originally Posted by Cruz View Post
    Hm, yes. That approach is probably a lot easier. A problem that still remains though is that the library has to be installed on every machine where the project is being developed.
    Not really. You can compile it in statically into your application.

    In any case, I would still like to understand what this compiler error is that I'm seeing. What does it mean by dllimported class?
    That's because of one of those stupid Windows macros. It'll be best if you google for "dllimport" and "dllexport" but before you do, try removing the QGLVIEWER_EXPORT macro from every class declaration or make sure the macro is empty (you'll have to find where it is defind and rem it out). This should be enough to make it build.

  6. The following user says thank you to wysota for this useful post:

    Cruz (29th January 2009)

  7. #5
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Need help with compiling on Windows

    Right! I can see the macros. Thanks a lot. Nothing is as enlightening as getting your stupid questions answered.

Similar Threads

  1. Qt Jambi, deploying app on Mac & Windows fails
    By ChrisColon in forum Installation and Deployment
    Replies: 2
    Last Post: 16th February 2009, 22:05
  2. Replies: 5
    Last Post: 15th January 2009, 09:03
  3. Error when compiling for static version in windows
    By que in forum Installation and Deployment
    Replies: 4
    Last Post: 28th October 2008, 20:41
  4. Compiling qshortcutdialog on Windows with mingw
    By dvmorris in forum Qt Programming
    Replies: 2
    Last Post: 23rd April 2007, 19:16
  5. Replies: 10
    Last Post: 28th April 2006, 15:48

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.