visual-studio-2010 - 静态链接,Visual Studio和FLANN

我正在尝试在Visual Studio 2010中编译FLANN_Example.cpp。该文件是Fast Library for Approximate Nearest Neighbors(FLANN)的用法示例。它旨在产生可执行文件。我遍历了整个CMake例程,并安装了用于静态链接的HD5F库(依赖项)。

我可以编译其他所有东西-除了flann_example.cpp。

这是输出:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Build started: Project: flann_cpp_s, Configuration: Debug Win32 ------
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _setvbuf already defined in LIBCMTD.lib(setvbuf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isdigit already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalpha already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _abort already defined in LIBCMTD.lib(abort.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncmp already defined in LIBCMTD.lib(strncmp.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fopen already defined in LIBCMTD.lib(fopen.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isspace already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __errno already defined in LIBCMTD.lib(dosmap.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strrchr already defined in LIBCMTD.lib(strrchr.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalnum already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strcspn already defined in LIBCMTD.lib(strcspn.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __read already defined in LIBCMTD.lib(read.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __get_osfhandle already defined in LIBCMTD.lib(osfinfo.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __open already defined in LIBCMTD.lib(open.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __write already defined in LIBCMTD.lib(write.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __lseeki64 already defined in LIBCMTD.lib(lseeki64.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __chsize_s already defined in LIBCMTD.lib(chsize.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __close already defined in LIBCMTD.lib(close.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __fileno already defined in LIBCMTD.lib(fileno.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fread already defined in LIBCMTD.lib(fread.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fflush already defined in LIBCMTD.lib(fflush.obj)
2>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
2>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
2>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
2>C:\flann-1.6.11-src\bin\lib\Debug\flann_example.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

这是我的其他包括目录:
C:\Program Files %28x86%29\HDF Group\HDF5\1.8.7\include\cpp;
C:/flann-1.6.11-src/src/cpp;
%(AdditionalIncludeDirectories)

这是我在链接程序下的其他依赖项:
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_cpp.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_hl_cpp.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_hl.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\tools\hdf5_tools.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\zlib.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\libszip.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp_s.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_s.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp-gd.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp_s-gd.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp.lib;%(AdditionalDependencies)

编译器选项:

/I"C:\Program Files (x86)\HDF Group\HDF5\1.8.7\include\cpp" /I"C:/flann-1.6.11- src/src/cpp" /Zi /nologo /W3 /WX- /Od /Ob0 /Oy- /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_FLANN_VERSION=1.6.11" /D "FLANN_STATIC" /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /Gm- /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fp"flann_cpp_s.dir\Debug\flann_example.pch" /Fa"Debug" /Fo"flann_cpp_s.dir\Debug\" /Fd"C:/flann-1.6.11-src/bin/lib/Debug/flann_cpp_s.pdb" /Gd /TP /analyze- /errorReport:queue



一些帮助将不胜感激!我花了太多时间在此上。

最佳答案

事实证明,这是“确保您静态地编译所有内容”的另一种情况。

https://stackoverflow.com/questions/7106711/

相关文章:

compiler-errors - pygame炮弹碰撞检测

compilation - apt-pkg编译问题

linux-kernel - Linux内核补丁问题

java - 比较原始类型

visual-studio-2008 - 双击Visual Studio 2008编译错误不会将我带

gcc - 编译器的错误如何标准化?

asp.net - 运行时CS0234在VS2010 Web应用程序中访问SOAP Web服务时出错

objective-c - UIAlertView dismissWithClickedButton

c++ - 新手Chrome插件开发人员需要NPAPI入门方面的帮助

php - 生成php_perl.dll失败