views:

595

answers:

1

I started using Qt Creator recently and it seems to work well. A sample application I build on OS X uses the ImageMagick library.

No problems there - everything works as expected. I built the ImageMagick libraries from source.

Now I move over to the Windows side and the linking troubles start. Qt Creator on Windows uses MinGW and not the Microsoft's compiler, but the ImageMagick library was compiled with VC.

In short - I cannot link the prebuilt libraries on Windows against my Qt Creator project using gcc

This means I have to recompile the ImageMagick libraries using MinGw, but I have never used GCC on Windows before. How do I run ./configure ?

ImageMagick comes with "windows sources", but they are all tailored for VisualStudio.

Can anyone help? Anyone already linked ImageMagick library into their Qt Creator program on Windows?

Thanks,

Dj.

A: 

You need to link against more than just libMagick++.a. libMagickCore.a for starters, and probably libMagickWand.a, as well as several dependencies (these depend on how you compiled IM), such as -lz -ltiff -ljpeg -lpng12 -lgdi32 -lpthread -lfreetype.

Matthew

Matthew Talbert
Matthew,I can compile the same sources on OS X for example and link it by just linking in the libMagicklibMagick itself links these other dependencies while its being built. Therefore, it makes no sense to link them again (as it is obviously the case in OS X ) I gave up on this since it wasn't worth the trouble and developers seem not to care about compiling on Windows. Too bad since the library looked promising. Qt itself seems to have enough image support for now to comple what I was working on.Thanks.
Linking works differently on OS X and on Windows. I don't actually know much about OS X, but assuming it's like linux, it can resolve symbol definitions at runtime. On Windows, they must all be defined at compile time. Therefore, you need to link all libraries.
Matthew Talbert
>" it can resolve symbol definitions at runtime"We are talking about static libraries, not dynamic. Nothing is happening at runtime if you link everything statically.Moreover - if the problem was only at runtime - the application would compile just fine, then crash at runtime (for example on windows you would compile it, but if dll is missing the app will not start).>"Linking works differently on OS X and on Windows"How is it different? I am not aware of any differences if one uses the same compiler? Can you give me more information?
Are you sure you're using the static libraries on Mac OS X? It has been my experience that when linking on linux, one needs only to specify one library and it does indeed link in the rest. However, on Windows, you need to explicitly link each static library. I should have said that the executable file format is different on Windows vs *nix rather than linking works differently. But essentially one leads to the other, because the linker has to create an entirely different file format for Windows.
Matthew Talbert