PDA

View Full Version : Need help with compiling on Windows



Cruz
28th January 2009, 21:38
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?

wysota
28th January 2009, 23:02
Making the project file work differently on different platforms is not a problem, just use scopes:

win32:LIBS+=-L../mywindows/library/folder
linux:LIBS+=-L../mylinux/library/folder

Cruz
28th January 2009, 23:45
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?

wysota
29th January 2009, 02:33
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.

Cruz
29th January 2009, 11:09
Right! I can see the macros. Thanks a lot. Nothing is as enlightening as getting your stupid questions answered.