Project

General

Profile

wstring linker problem under windows

Added by Philipp Simmler over 9 years ago

hi there,

After downloading and compiling exiv2 including and all its additional libraries (e.g. zlib & expat) using the msvs2010 solution (i created all release/debug and the two dlls). I have the following problem:

error LNK2019: unresolved external symbol "public: __thiscall Exiv2::FileIo::FileIo(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"
This is also the case for Exiv2::ImageFactory::open().

So basically it seams i'm not able to open any file using wstrings. Has anyone any idea how to solve that? how do i have to compile the solution to have that working?

Thanks a lot in advance!
donny


Replies (3)

RE: wstring linker problem under windows - Added by Robin Mills over 9 years ago

I'm not sure I know what you've done. What's the msvs2010 solution?

I recommend you open exiv2/msvc64/exiv2.sln in DevStudio, Build/BatchBuild/SelectAll/Build and you should be good. You should put expat and zlib in a "parallel" directory to exiv2 like this:

Directory of C:\gnu.2010
2012-08-15 10:12 <DIR> exiv2
2012-08-15 10:13 <DIR> expat-2.1.0
2012-08-15 10:13 <DIR> zlib-1.2.7

exiv2/msvc64/exiv2.sln will build and link expat-2.1.0 and zlib-1.2.7 for you.

Your link error looks as though you're not linking the exiv2 library with you code. For the Debug/DLL builds, the exiv2 libraries are:

./exiv2lib/Win32/DebugDLL/exiv2d.lib <--- there's a D in the debug library filename
./exiv2lib/Win32/DebugDLL/libexpat.lib
./exiv2lib/Win32/DebugDLL/zlib1d.lib

Are you linking your own application, or linking one of the sample applications (such as exiv2.exe, exifprint.exe) ?

RE: wstring linker problem under windows - Added by Philipp Simmler over 9 years ago

hi there,

sorry with solution i meant the .sln and i batchbuilded everything like you mentioned.
I have an older version of zlib 1.2.5 and also of expat 2.0.1 (for exiv2 0.23), but i guess except of being outdated this should not be the problem.

Also the linker doesnt have any problems to find the open( std::string) version or the FiloIo(std::string). Its just for the std::wstring versions i run into linker errors.
Can/Should I set the #define EXV_UNICODE_PATH myself?

finally to answer your question I'm linking my own application. And Therefore I copied all dll's, lib's and .h files to were i need them. And again, I'm able to produce the output i want using different functions from the exiv2 library. It's just as soon as I'm trying to use the std::wstring version of this two functions, the linker is not able to find the sources....

Thanks a lot in advance

RE: wstring linker problem under windows - Added by Robin Mills over 9 years ago

Right. We're on the same page now. My guess about your intention was right - you do have your own code.

You can use zlib 1.2.5 and expat 2.0.1 if you wish and this is explained in exiv2/msvc64/ReadMe.txt. The move to zlib 1.2.7 and expat 2.1.0 is documented in http://dev.exiv2.org/issues/817.

EXV_UNICODE_PATH is set in exiv2/msvc64/include/exv_msvc.h, so I don't think that is the fix to support std::wstring. Google is your friend here. There might be a "standard" method to tell MSVC to compile std::string as std::wstring. If you discover this, perhaps you could update this thread for others to know the magic potion.

If there's no easy fix, then supporting this is an enhancement request and should be logged as a new issue with a title such as "Please support std::wstring in exiv2 path access". If you submit a patch with the issue, I'll review your code and add it to the code base.

If you wish to email me your code (robin at clanmills dot come), I'll investigate for you (and respect your code as confidential). I'm on vacation until August 26, so my time and internet access is restricted over the next 10 days.

    (1-3/3)