Project

General

Profile

Redefinition error while compiling DLL with Visual Studio

Added by Achim Schäfer over 9 years ago

Hello,

Environment: Win7 x64, exiv2-0.22, Visual Studio 11 (Beta), trying to compile 64 Bit DLL (msvc64\exiv2.sln)

I'm getting a lot of errors of type "C2371: 'int8_t : redefinition; different basic types" but cannot find any typedef redefining int8_t.

I know it's a bit "risky" to use a beta compiler but as far as I know the changes between VS 2010 and VS 11 are mainly in the IDE and the .NET parts (version 4.5 support) and all this Windows 8 stuff but not in the C++ compiler.

Any idea what is going wrong?

Or is it possible to just download a compiled DLL? Also some .NET wrapper would be welcome as I'm writing normally in C#....

I want to use exiv2 in a workflow software for my own needs because I'm disappointed in the lack of network support in Adobe Lightroom 4 and Corel Aftershot Pro doesn't have the possibility to extensive renaming and making backups to another drive at the same time. And for grouping the raw material I want inspect the real shooting date and the GPS coordinates (my Sony Alpha 55 has GPS on board) - I cannot rely on file dates as sometimes/often I have to work with copies to external drives etc.

TIA from Nuremberg
Achim


Replies (6)

RE: Redefinition error while compiling DLL with Visual Studio - Added by Andreas Huggel over 9 years ago

Hi Achim,

This is important feedback, thanks. Can you try to compile the trunk? (see http://www.exiv2.org/download.html#devel)
There was a recent change (http://dev.exiv2.org/projects/exiv2/repository/revisions/2623/diff) to cater for the new stdint.h include file, introduced with DevStudio 2010. Before that, MSVC didn't have these C99 types, so Exiv2 defined them. It would be good to hear if the current trunk also works with Visual Studio 2011 (Beta).

Andreas

RE: Redefinition error while compiling DLL with Visual Studio - Added by Achim Schäfer over 9 years ago

Hi,

thanks for the quick reply, I'll test it this evening.

greetings from Nuremberg
Achim

RE: Redefinition error while compiling DLL with Visual Studio - Added by Achim Schäfer over 9 years ago

Hi Andreas,

as suggested I downloaded the trunk via subversion and copied the xpat and zlib lib sources to the correct positions. I used the same environment as before (x64 etc.) and the DLL configurations (both debug and release compiled well without errors and the following warnings:

Warning 1 warning C4013: 'write' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzwrite.c 84 1 zlib1
Warning 2 warning C4013: 'close' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzwrite.c 558 1 zlib1
Warning 3 warning C4013: 'read' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzread.c 30 1 zlib1
Warning 4 warning C4013: 'close' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzread.c 581 1 zlib1
Warning 5 warning C4013: 'open' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzlib.c 180 1 zlib1
Warning 6 warning C4013: '_lseeki64' undefined; assuming extern returning int p:\projekte\e\zlib-1.2.5\gzlib.c 204 1 zlib1
Warning 7 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification P:\Projekte\E\exiv2-0.22\msvc64\expat\xmlparse.obj expat
Warning 8 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification P:\Projekte\E\exiv2-0.22\msvc64\zlib\adler32.obj zlib1
Warning 9 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification P:\Projekte\E\exiv2-0.22\msvc64\expat\xmlparse.obj expat

The "normal" configurations both had an error:

Error 19 error LNK2019: unresolved external symbol _imp_vsnprintf referenced in function _gzprintf P:\Projekte\E\exiv2-0.22\msvc64\exiv2\zlib1d.lib(gzwrite.obj) exiv2
Error 20 error LNK1120: 1 unresolved externals P:\Projekte\E\exiv2-0.22\msvc64\exiv2\Win32\Debug\exiv2.exe exiv2

(There are also 18 warnings. That's the reason why the first error is no. 19...)

Then I tried the resulting exe from the ReleaseDLL configuration with some pictures, plain jpg files and raw files from my Sony alpha55 (arw) and Canon 20D (cr2). EXIF data all showed up correctly. Only one thing is kind of peculiar: the downloaded exe accepts wildcards - my self compiled version does not????

So my next step is to incorporate your lib in my C# project... Are there any wrappers around or some examples? My experience with C++ and incorporating C++ dlls in .NET projects is a little bit "rusty" - my twitter name is "Dotnet_Oldie"....

Thank's a lot for this lib!

greetings from Nuremberg
Achim

RE: Redefinition error while compiling DLL with Visual Studio - Added by Andreas Huggel over 9 years ago

Sorry for the late reply. There is some old sample code in msvc/exivsimple which may be of interest, but I'm really not sure.

Andreas

RE: Redefinition error while compiling DLL with Visual Studio - Added by Robin Mills over 9 years ago

Thank you for using the exiv2 library.

DevStudio 10 added stdint.h and you'll have to make that known to the compiler. We added code to exv_msvc.h to support this.

#if _MSC_VER >= 1600
// stdint.h was introduced with DevStudio 2010
#define EXV_HAVE_STDINT_H 1
#endif

However the xmpsdk (which is provided by Adobe) doesn't appear to take advantage of stdint.h

#if XMP_MacBuild // ! No stdint.h on Windows and some UNIXes.
#include <stdint.h>
#endif

And I think that may cause this message. It's rather odd the DevStudio 10 (2010) didn't complain about this.

You'll find the compiler switches /E, /P and /showIncludes very helpful for tracking down the culprit.

It's probably useful to take a look in Adobe Labs (or wherever the latest xmpsdk can be located).

For the moment, I haven't looked at DevStudio 11. Perhaps an Express Edition of a supported compiler will be a quicker road to happiness.

Andreas Grimme (take care, not Andreas Huggel) published a .Net wrapper about 4 years ago (around exiv2 0.16 or so) I was able to build and run that successfully. I believe the source is still available from the exiv2 forum on yahoo.co.uk. We don't support this offering, however you might find the code useful for inspiration. You might even get lucky and it'll just work for you with very little effort.

RE: Redefinition error while compiling DLL with Visual Studio - Added by Robin Mills over 9 years ago

Achim

I pulled down the 2GByte Visual Studio 11 Ultimate Beta. A heavy beast which occupies 10Gbytes on the disk and took about 4-5 hours to install on my 2 year old 64bit Sony Vaio. It's DevStudio with another makeover and plenty of fresh paint. I really liked the animation during installation. I had plenty of time to watch it. Then another hour to download and install the update. Anyway it's working fine. I've always really liked DevStudio (although hardly used 2010).

I've built exiv2/msvc64/exiv2.sln and everything seems OK to me. I pulled down the latest code from the exiv2 trunk. This is the release candidate for exiv2 0.23. I builds OK for me (all 40 targets). I've run the sanity tests (exiv2/msvc64/runner.py).

Visual Studio 11's batch build seems a little suspect to me. It ran very quickly and said "5 succeeded, 35 failed". So I used the dentist's method (pulled them out one at a time). I selected Debug/x64/exiv2 build. (yawn) DebugDLL .... for the 8 targets (Debug|DebugDLL|Release|ReleaseDLL)x(Win32|x64) and everything built. The build hung several times and I had to cancel it, terminate/restart DevStudio several times. I'll give the blame to Redmond Prerelease Blues.

    (1-6/6)