Newbie : Exiv2 Linking errors
Added by Shanmuga 2020 over 7 years ago
I have compiled the exiv2-0.24 with zlib-1.2.7,expat-2.1.0 in the Microsoft Visual Studio 2008
Version 9.0.21022.8 express edition the library build without any error. I checked the library using your example program,(// Sample program to print the Exif metadata of an image) it shows the following linking error msg please give suggestion for fix this error. I added the lib and include path. i have the following libraries in this folder E:\gnu\exiv2-0.24\msvc2005\exiv2lib\Win32\DebugDLL libraries are exiv2d.dll, libexpat.dll, zlib1d.dll,exiv2d,libexpat, zlib1d the errors are
main.obj : error LNK2019: unresolved external symbol "public: static class std::auto_ptr<class Exiv2::Image> __cdecl Exiv2::ImageFactory::open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?open@ImageFactory@Exiv2@SA?AV?$auto_ptr@VImage@Exiv2
@std
@ABV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2
@4@Z) referenced in function _main
@UAE@XZ) referenced in function __unwindfunclet$??0?$BasicError@D@Exiv2@
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Exiv2::AnyError::~AnyError(void)" (??1AnyError@Exiv2QAE@ABV01
@Z$0
1>main.obj : error LNK2019: unresolved external symbol "private: void __thiscall Exiv2::BasicError<char>::setMsg(void)" (?setMsg@?$BasicError@D@Exiv2@AAEXXZ) referenced in function "public: __thiscall Exiv2::BasicError<char>::BasicError<char><class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$?0V?$basic_string@DU?$char_traits@D@std
@V?$allocator@D@2@std
@?$BasicError@D@Exiv2
@QAE@HABV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2
@std@@@Z)
1>E:\gnu\exiv-test\exivtest\Debug\exivtest.exe : fatal error LNK1120: 3 unresolved externals
Replies (6)
RE: Newbie : Exiv2 Linking errors - Added by Robin Mills over 7 years ago
Hi S
It would appear that you haven't linked exiv2d.lib. The command line to link samples/exifprint.exe generated by VisualStudio2005 is:
/OUT:"Win32\DebugDLL/exifprint.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"build\Win32\DebugDLL\exifprint.exe.intermediate.manifest" /DEBUG /PDB:"Win32\DebugDLL/exifprint.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT ..\exiv2lib\Win32\DebugDLL\exiv2d.lib ..\expat\Win32\DebugDLL\libexpat.lib ..\xmpsdk\Win32\DebugDLL\xmpsdk.lib ..\zlib\Win32\DebugDLL\zlib1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
I assume your test program is "exiftest.cpp" and something like exifprint. A "no effort required" method, is to put your code into the file samples/exifprint.cpp. Build and that's that! Of course your program is called "exifprint.exe". But it's taken no effort get up and running.
If you want your own project and executable, I recommend that you put your code into the samples directory, and copy exivprint.vcproj to exiftest.vcproj. Change all exivprint -> exiftest. Add exiftest.vcproj to exiv2.sln an open exiv2.sln in Visual Studio. With good fortune, your code will built, link and you can debug it if you wish.
Once you have your code up and running, you may wish to store exiftest.vcproj and code in a totally different directory. Move it and update the various include and linker paths until you get things working.
Robin
RE: Newbie : Exiv2 Linking errors - Added by Shanmuga 2020 over 7 years ago
Dear Robin,
Apologies for late reply, I was busy in some other works.
I dont have any issue in exifprint test program. Its working fine.
My original requirement is I am trying to modify some exiv datas in a photo ( for example ) I am trying to use this lib in my program.
I copied libs and dll, include files in a separate folder and linked with my project.
For testing I copied the exifprint test program here and try to build the project and am getting the above error.
Many Thanks
Shanmuga
RE: Newbie : Exiv2 Linking errors - Added by Shanmuga 2020 over 7 years ago
Dear Robin,
I have the following files and the structure, I also added this path to my project.
E:\gnu\Exiv2-Libs\Dlls\
E:\gnu\Exiv2-Libs\Dlls\exiv2d.dll
E:\gnu\Exiv2-Libs\Dlls\libexpat.dll
E:\gnu\Exiv2-Libs\Dlls\zlib1d.dll
E:\gnu\Exiv2-Libs\Libs\
E:\gnu\Exiv2-Libs\Libs\exiv2d.lib
E:\gnu\Exiv2-Libs\Libs\libexpat.lib
E:\gnu\Exiv2-Libs\Libs\xmpdsk.lib
E:\gnu\Exiv2-Libs\Libs\zlib1d.libexpat
E:\gnu\Exiv2-Libs\Include\
E:\gnu\Exiv2-Libs\Include\Exiv2\
E:\gnu\Exiv2-Libs\Include\expat\
E:\gnu\Exiv2-Libs\Include\Zlib\
Many Thanks,
V.Shanmuga.,
RE: Newbie : Exiv2 Linking errors - Added by Robin Mills over 7 years ago
Zip up E:\gnu\Exiv2-Libs and attach it to this topic (or email it, or put it somewhere that I can find it). I'll fix it for you. robin@clanmills.com
Robin
RE: Newbie : Exiv2 Linking errors - Added by Shanmuga 2020 over 7 years ago
Hi Robin,
Thanks for your reply.
Herewith I have attached the E:\gnu\Exiv2-Libs Folder (rar File) for your reference.
Regards
V.Shanmuga
Exiv2-Libs.rar (5.4 MB) Exiv2-Libs.rar |
RE: Newbie : Exiv2 Linking errors - Added by Robin Mills over 7 years ago
Hi V
I attach exiftest.vcproj - this contains the magic you need to build Win32|DebugDLL. You should drop this into e:\gnu\Exiv2-Libs and copy samples/exifprint.cpp e:\gnu\Exiv2-Libs. Build Win32|DebugDLL.
I also attach exifprint.vcproj. Use a diff tool (such as WinMergeU) to see the differences. I've pretty printed both files with XMLlint for read-ability.
I've focused on getting Win32|DebugDLL and Win32|Debug to build. I haven't bothered with any Release or x64 builds. The main changes are:
1) Changing exifprint to exiftest everywhere
2) Updating OutputDirectory (build into Dlls)
3) Change AdditionalIncludeDirectories by adding $(ProjectDir)/Include/exiv2/include;
4) Changing the linking attributes to link libraries from $(ProjectDir)/Libs
5) Remove all <Tool> ... copy target to bin ... </Tool>
- You don't need to copy target to the bin. You're building directly into your Dlls directory
6) Remove all <Tool> ... copy the dlls ... </Tool>
- You don't need to copy Dlls, you're building into your Dlls directory
7) Change the <File>...</File> to find getopt_win32.c and friends in the ../trunk/src
I've tested this with Visual Studio 2008. It works fine with your DLLs. You didn't provide exiv2sd.lib to link Win32|Debug
You'll have to deal with Release and ReleaseDLL and you'll probably want to deal with the x64 configurations. Working on these other configurations will give you more confidence. Incidentally, I find the UI in Visual Studio "kind of" useful. However for making lots of systematic changes, it's usually easier to edit the XML directly - especially when you're dealing with 8 configurations (Debug, DebugDLL, Release, ReleaseDLL x 2 (Win32 and x64).
Good Luck. Try to find somebody who knows Visual Studio to help you with this. This topic is really about Visual Studio and doesn't have much to do with Exiv2.
Robin
exiftest.vcproj (19.7 KB) exiftest.vcproj | |||
exifprint.vcproj (24.8 KB) exifprint.vcproj |