[Insight-users] Re: Problem with VC++ and ITK
Luis Ibanez
luis.ibanez at kitware.com
Thu May 10 07:51:38 EDT 2007
Hi Frederic,
This type of primitive errors only happen when you
don't use CMake for configuring your project.
Please use CMake for configuring your project, as
explained in the ITK Tutorials and in the
ITK Software Guide.
Your time will be better spent on doing image processing
than dealing with the little configuration boxes of
Visual Studio. There is no reason for wasting time in
primitive configuration issues, when you have at hand a
straight forward solution by just using CMake.
Regards,
Luis
=========================
Frédéric Stevens wrote:
> Hi,
>
> I am trying to create a simple project in VC++ 8.0. As i've seen already
> on a few posts, some people had the same problems and you dealt with it.
> I am writing to you because I don't manage to solve those problems :
> it's about a link problem :
> Here is the log of the errors :
>
> Error 1 error LNK2005: _getenv already defined in
> LIBCMTD.lib(getenv.obj) MSVCRTD.lib
> Error 2 error LNK2005: __errno already defined in
> LIBCMTD.lib(dosmap.obj ) MSVCRTD.lib
> Error 3 error LNK2005: _free already defined in
> LIBCMTD.lib(dbgheap.obj) MSVCRTD.lib
> Error 4 error LNK2005: _tolower already defined in
> LIBCMTD.lib(tolower.obj) MSVCRTD.lib
> Error 5 error LNK2005: _isspace already defined in
> LIBCMTD.lib(_ctype.obj) MSVCRTD.lib
> Error 6 error LNK2005: _isalpha already defined in
> LIBCMTD.lib(_ctype.obj) MSVCRTD.lib
> Error 7 error LNK2005: _isupper already defined in
> LIBCMTD.lib(_ctype.obj) MSVCRTD.lib
> Error 8 error LNK2005: _strncmp already defined in
> LIBCMTD.lib(strncmp.obj) MSVCRTD.lib
> Error 9 error LNK2005: _atoi already defined in
> LIBCMTD.lib(atox.obj ) MSVCRTD.lib
> Error 10 error LNK2005: _abort already defined in
> LIBCMTD.lib(abort.obj) MSVCRTD.lib
> Error 11 error LNK2005: ___iob_func already defined in
> LIBCMTD.lib(_file.obj) MSVCRTD.lib
> Error 12 error LNK2005: __stricmp already defined in
> LIBCMTD.lib(stricmp.obj) MSVCRTD.lib
> Error 13 error LNK2005: _fclose already defined in
> LIBCMTD.lib(fclose.obj) MSVCRTD.lib
> Error 14 error LNK2005: _strftime already defined in
> LIBCMTD.lib(strftime.obj) MSVCRTD.lib
> Error 15 error LNK2005: _sprintf already defined in
> LIBCMTD.lib(sprintf.obj) MSVCRTD.lib
> Error 16 error LNK2005: __CrtSetReportHook already defined in
> LIBCMTD.lib(dbgrptt.obj) MSVCRTD.lib
> Error 17 error LNK2005: _fflush already defined in
> LIBCMTD.lib(fflush.obj) MSVCRTD.lib
> Error 18 error LNK2005: __invalid_parameter already defined in
> LIBCMTD.lib (invarg.obj) MSVCRTD.lib
> Error 19 error LNK2005: __CrtDbgReportW already defined in
> LIBCMTD.lib(dbgrptw.obj) MSVCRTD.lib
> Error 20 error LNK2005: "public: virtual __thiscall
> std::exception::~exception(void)" (??1exception at std@@ UAE at XZ) already
> defined in LIBCMTD.lib(stdexcpt.obj) MSVCRTD.lib
> Error 21 error LNK2005: "public: __thiscall
> std::exception::exception(void)" (??0exception at std@@QAE at XZ) already
> defined in LIBCMTD.lib (stdexcpt.obj) MSVCRTD.lib
> Error 22 error LNK2005: "public: __thiscall
> std::exception::exception(class std::exception const &)"
> (??0exception at std@@QAE at ABV01@@Z) already defined in LIBCMTD.lib
> (stdexcpt.obj) MSVCRTD.lib
> Error 23 error LNK2005: "public: __thiscall
> std::exception::exception(char const * const &)"
> (??0exception at std@@QAE at ABQBD@Z) already defined in
> LIBCMTD.lib(stdexcpt.obj ) MSVCRTD.lib
> Error 24 error LNK2005: "private: __thiscall
> type_info::type_info(class type_info const &)"
> (??0type_info@@AAE at ABV0@@Z) already defined in
> LIBCMTD.lib(typinfo.obj) MSVCRTD.lib
> Error 25 error LNK2005: "private: class type_info & __thiscall
> type_info::operator=(class type_info const &)"
> (??4type_info@@AAEAAV0 at ABV0@@Z) already defined in
> LIBCMTD.lib(typinfo.obj) MSVCRTD.lib
> Warning 26 warning LNK4098: defaultlib 'MSVCRTD' conflicts with
> use of other libs; use /NODEFAULTLIB:library binarytest
> Error 27 fatal error LNK1169: one or more multiply defined symbols
> found c:\Documents and Settings\Zaraki Kenpachi\Mes documents\Visual
> Studio 2005\Projects\binarytest\binarytest\Debug\binarytest.dll
>
>
>
> As it's written, there's a conflict between libra&ry (warning 26). So I
> have ignored this specific library. But as for the others, there r new
> problems :
> Warning 1 warning LNK4217: locally defined symbol _getenv imported
> in function "public: static char const * __cdecl
> itksys::SystemTools::GetEnv(char const *)" (?GetEnv@
> SystemTools at itksys@@SAPBDPBD at Z) itksys.lib
> Warning 2 warning LNK4217: locally defined symbol __errno imported
> in function "public: static bool __cdecl
> itksys::SystemTools::MakeDirectory(char const *)" (?MakeDirectory@
> SystemTools at itksys@@SA_NPBD at Z) itksys.lib
> Warning 3 warning LNK4217: locally defined symbol _free imported
> in function "public: static void __cdecl
> itksys::SystemTools::ReplaceString(class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > &,char const *,char
> const *)"
>
> etc.
> Error 31 error LNK2019: unresolved external symbol __imp___ftime64
> referenced in function "public: static double __cdecl
> itksys::SystemTools::GetTime(void)"
> (?GetTime at SystemTools@itksys@@SANXZ) itksys.lib
> Error 32 error LNK2019: unresolved external symbol __imp___mkdir
> referenced in function "int __cdecl Mkdir(char const *)"
> (?Mkdir@@YAHPBD at Z) itksys.lib
> Error 33 error LNK2019: unresolved external symbol __imp__strdup
> referenced in function "public: static void __cdecl
> itksys::SystemTools::ReplaceString(class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > &,char const *,char
> const *)" (?ReplaceString@
> SystemTools at itksys@@SAXAAV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@PBD1 at Z)
> itksys.lib
>
> etc.
>
> Error 56 error LNK2019: unresolved external symbol
> __imp___findfirst64i32 referenced in function "public: bool __thiscall
> itksys::Directory::Load(char const *)" (?Load@
> Directory at itksys@@QAE_NPBD at Z) itksys.lib
> Error 57 error LNK2001: unresolved external symbol
> __imp___strdup OLDNAMES.lib
> Error 58 error LNK2001: unresolved external symbol
> __imp___unlink OLDNAMES.lib
> Error 59 error LNK2001: unresolved external symbol
> __imp___chmod OLDNAMES.lib
> Error 60 fatal error LNK1120: 26 unresolved externals
> Debug\binarytest.dll
>
> You have said that the problem was due to a mix of static library and a
> dynamic one. In the "code generation part", I have put as
> "Multi-threaded Debug (/MTd)".
> In my code, before putting any library from ITk, it was working. Just
> adding the libraries made it do the errors. But it was especially on one
> : I mean it was building with no problems when I included :
> "
> #include "idl_export.h"
> #include "itkBinaryThresholdImageFilter.h"
> // Software Guide : EndCodeSnippet
>
> #include "itkImage.h"
> #include "itkImageFileWriter.h"
> "
> But when i'm adding " #include " itkImageFileReader.h" ", it makes all
> the errors.
>
> I would be grateful if you could help me on that problem.
>
> Thank you in advance,
> Frédéric STEVENS
>
>
More information about the Insight-users
mailing list