Using a set of libraries
This may not be the most relevant place to ask it, but I want to load a certain file format into memory in Qt on Windows.
So the creators of the file format give you this zip file (which they claim is really "compile for vs2005") with multiple folders:
bin <- contains some .exe and .dll files
include <- contains a bunch of .h files
lib <- contains a bunch of .lib files with
In the lib folder there are multiple files, typically 4 versions of each, for example:
I assume that the _d means debug, but I don't understand why there are then still two flavors of that. I'm sure that for someone who does this kinda thing a lot it would make sense.
I don't care whether I link statically or dynamically I just want the stuff to link successfully. I include the folder with all the .h files in my .pro file like this:
@INCLUDEPATH += ../../OpenEXR/include
DEPENDPATH += ../../OpenEXR/include@
And add a library like this:
@LIBS += -L../../OpenEXR/lib/ -lsomething@
Now, is there anything else that I would need to do to get it working? I constantly get the compiler/linker error "undefined reference to..." for stuff that are defined in the .h files but it looks to me like the linker isn't finding the real stuff. Do I need to somehow reference the folder with the .dll files?
Please, if someone helps me, could you always refer to files by extension (.lib or .dll); generic use of words like "library" is a big source of my confusion.
There are two types of libraries, static and shared. In addition, for shared libraries there exist import libraries, which are used by the linker at compile time to resolve symbols within the shared library.
So I guess something.lib and something_d.lib are static libraries, release and debug. something_dll.lib and something_dll_d.lib are the import libraries, release and debug. There are most probably something.dll and something_d.dll somewhere too.
If you want to link the libraries statically you will have to use something.lib. If you want to link the libraries dynamically you will have to use something_dll.lib AND use the __declspec(dllimport) directive for every symbol imported from the shared library (as symbol name are mangled differently in static and shared libraries).
Apart from that your project file looks good (assuming the pathes are correct).
EDIT I just googled your library and you should take a look "here":http://hebbut.net/Public.Offerings/OpenEXR.html, especially the Known Issues section.
Thanks a lot Lukas for going so far with helping me. The "how" does make sense to me more. Not sure I understand "why" though :)
As for getting it working I've pretty much given up.
Have you read the article I linked? Your problem can possibly solved by just adding
DEFINES += OPENEXR_DLL
to your project file.
Thanks again, after reading the link you posted I did exactly that, then cleaned, qmade and rebuilt, but it didn't solve the problem.