nyanp / mnisten

convert image files to mnist idx format
61 stars 30 forks source link

Using VS2013+OPENCV3.1.0 compile this,will error: >main.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z),该符号在函数 "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) 中被引用 #10

Closed angelanf5 closed 8 years ago

angelanf5 commented 8 years ago

configuration list: VS2013 PC win7x64 opencv 3.1.0 boost boost_1_61_0

i guess whether opencv 3.1 is too high, so it fails. is it ? waiting for your help:) thank u!

vs2013 set: property--linker--input-- opencv_world310d.lib;%(AdditionalDependencies) default

compile it ,it will: 1>------ 已启动全部重新生成: 项目: mnisten, 配置: Debug Win32 ------ 1> main.cpp 1>d:\opencv\build\include\opencv2\core\mat.hpp(1965): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>d:\opencv\build\include\opencv2\core\persistence.hpp : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>d:\opencv\build\include\opencv2\core\utility.hpp : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>k:\同步文件夹\桌面-angelanf5\mnisten-master\mnisten-master\include\cmdline.h(724): warning C4101: “e”: 未引用的局部变量 1> k:\同步文件夹\桌面-angelanf5\mnisten-master\mnisten-master\include\cmdline.h(719): 编译类 模板 成员函数“bool cmdline::parser::option_with_value::set(const std::string &)”时 1> with 1> [ 1> T=std::string 1> ] 1> k:\同步文件夹\桌面-angelanf5\mnisten-master\mnisten-master\include\cmdline.h(365): 参见对正在编译的类 模板 实例化“cmdline::parser::option_with_value”的引用 1> with 1> [ 1> T=std::string 1> ] 1> k:\同步文件夹\桌面-angelanf5\mnisten-master\mnisten-master\src\main.cpp(169): 参见对正在编译的函数 模板 实例化“const T &cmdline::parser::getstd::string(const std::string &) const”的引用 1> with 1> [ 1> T=std::string 1> ] 1>main.obj : error LNK2019: 无法解析的外部符号 "void cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z),该符号在函数 "public: thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "private: char * thiscall cv::String::allocate(unsigned int)" (?allocate@String@cv@@AAEPADI@Z),该符号在函数 "public: thiscall cv::String::String(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (??0String@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "private: void thiscall cv::String::deallocate(void)" (?deallocate@String@cv@@AAEXXZ),该符号在函数 "public: thiscall cv::String::~String(void)" (??1String@cv@@QAE@XZ) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "void cdecl cv::error(int,class cv::String const &,char const ,char const ,int)" (?error@cv@@YAXHABVString@1@PBD1H@Z),该符号在函数 "public: class cv::MatIterator_ _thiscall cv::Mat::begin(void)" (??$begin@E@Mat@cv@@QAE?AV?$MatIterator@E@1@XZ) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "public: void thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ),该符号在函数 "public: void thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "public: void thiscall cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QAEXABV12@@Z),该符号在函数 "public: thiscall cv::Mat::Mat(class cv::Mat const &)" (??0Mat@cv@@QAE@ABV01@@Z) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "public: void thiscall cv::MatConstIterator::seek(int,bool)" (?seek@MatConstIterator@cv@@QAEXH_N@Z),该符号在函数 "public: class cv::MatConstIterator & thiscall cv::MatConstIterator::operator++(void)" (??EMatConstIterator@cv@@QAEAAV01@XZ) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "public: void thiscall cv::MatConstIterator::seek(int const ,bool)" (?seek@MatConstIterator@cv@@QAEXPBH_N@Z),该符号在函数 "public: __thiscall cv::MatConstIterator::MatConstIterator(class cv::Mat const )" (??0MatConstIterator@cv@@QAE@PBVMat@1@@Z) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "void cdecl cv::resize(class cv::_InputArray const &,class cv::OutputArray const &,class cv::Size,double,double,int)" (?resize@cv@@YAXABV_InputArray@1@ABVOutputArray@1@V?$Size@H@1@NNH@Z),该符号在函数 "int cdecl read_images(class boost::filesystem::path const &,unsigned char,class std::vector<struct image,class std::allocator > &,int,int)" (?read_images@@YAHABVpath@filesystem@boost@@EAAV?$vector@Uimage@@V?$allocator@Uimage@@@std@@@std@@HH@Z) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号 "class cv::Mat cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@ABVString@1@H@Z),该符号在函数 "int cdecl read_images(class boost::filesystem::path const &,unsigned char,class std::vector<struct image,class std::allocator > &,int,int)" (?read_images@@YAHABVpath@filesystem@boost@@EAAV?$vector@Uimage@@V?$allocator@Uimage@@@std@@@std@@HH@Z) 中被引用 1>K:\同步文件夹\桌面-angelanf5\mnisten-master\mnisten-master\vc\Debug\mnisten.exe : fatal error LNK1120: 10 个无法解析的外部命令 ========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========

angelanf5 commented 8 years ago

I have solve it by myself. the reason is that when on X64 PC to compile boost, i should use Native Tools Command Prompt X64 to build it . type these:"b2 --build-type=complete toolset=msvc-12.0 threading=multi link=static address-model=64 ".
then set some path in visual studio :boost_1_61_0\boost_1_61_0\stage\lib, boost_1_61_0\boost_1_61_0.
and type "libboost_filesystem-vc120-mt-sgd-1_61.lib" in property. Set 项目属性->配置属性->C/C++->代码生成,选择“运行库”为“多线程 (/MT)”(如选择“多线程 DLL (/MD)”,则为动态链接 Boost 库)。(sorry , i use chinese at this) And use X64 debug to compile it . it will success. more information we can look at this link:
http://blog.csdn.net/gyy930324/article/details/51556694