link problem with Visual Studio 2012


Paul Miller <pa...@...>
 

I'm in the twilight zone today. After a bad merge from Mac->Windows, my application will no longer link against the shared OpenColorIO.lib on Windows, using Visual Studio 2012. This is the exact same set of headers and .lib I've been using for over a year.

The link errors are all like this one:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl OpenColorIO::v0::FileTransform::getNumFormats(void)" (__imp_?getNumFormats@FileTransform@v0@OpenColorIO@@SAHXZ)

and there seems to be an error for every OCIO function or definition I make use of, including:

error LNK2001: unresolved external symbol "__declspec(dllimport) char const * const OpenColorIO::v0::ROLE_DATA" (__imp_?ROLE_DATA@v0@OpenColorIO@@3PEBDEB)
error LNK2001: unresolved external symbol "__declspec(dllimport) char const * const OpenColorIO::v0::ROLE_COLOR_PICKING" (__imp_?ROLE_COLOR_PICKING@v0@OpenColorIO@@3PEBDEB)
error LNK2001: unresolved external symbol "__declspec(dllimport) char const * const OpenColorIO::v0::ROLE_SCENE_LINEAR" (__imp_?ROLE_SCENE_LINEAR@v0@OpenColorIO@@3PEBDEB)

Just for fun I cloned the current OCIO master branch, ran cmake on it, and rebuilt. I did have to make one change to OpenColorABI.h, and that is to get it to use <memory> and std::shared_ptr instead of boost or the tr1 stuff:

#elif defined(_LIBCPP_VERSION) || defined(WIN32)
#include <memory>
#define OCIO_SHARED_PTR std::shared_ptr
#define OCIO_DYNAMIC_POINTER_CAST std::dynamic_pointer_cast

But that's a minor change.

I'm linking with OpenColorIO.lib, but the linker is acting like nothing is being exported from it.

Has anyone else experienced anything like this?