New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed in vs2017 #245

Closed
huihut opened this Issue Jan 1, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@huihut
Copy link

huihut commented Jan 1, 2019

Build environment

  • Windows 10
  • CMake 3.12.4
  • Visual Studio 2017
  • OpenCV 4.0.1
  • Boost 1.66.0

CMake log

The CXX compiler identification is MSVC 19.16.27024.1
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Options:
EOS_BUILD_EXAMPLES: ON
EOS_BUILD_CERES_EXAMPLE: OFF
EOS_BUILD_UTILS: OFF
EOS_BUILD_DOCUMENTATION: OFF
EOS_GENERATE_PYTHON_BINDINGS: OFF
EOS_GENERATE_MATLAB_BINDINGS: OFF
Eigen3 found: TRUE, version: 3.3.4
Eigen3 include dir found at D:/code/VS/BabyCreator/eos/3rdparty/eigen
OpenCV ARCH: x86
OpenCV RUNTIME: vc15
OpenCV STATIC: OFF
Found OpenCV 4.0.0 in E:/opencv-4.0.1/opencv-4.0.1-vs-build/install/x86/vc15/lib
You might need to add E:\opencv-4.0.1\opencv-4.0.1-vs-build\install\x86\vc15\bin to your PATH to be able to run your applications.
Boost version: 1.66.0
Found the following Boost libraries:
  system
  filesystem
  program_options
Boost found at E:/boost_1_66_0
Configuring done
Generating done

VS error

I am using Chinese IDE

generate-obj.vcxproj

eos\include\eos\render\texture.hpp(101): error C2065: “CV_BGR2BGRA”: 未声明的标识符 (undeclared identifier)

fit-model-simple.vcxproj

1>boost_program_options-vc140-mt-gd.lib(boost_program_options-vc141-mt-gd-x32-1_68.dll) : error LNK2005: "public: __thiscall boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper<char>(void)" (??0?$value_semantic_codecvt_helper@D@program_options@boost@@QAE@XZ) 已经在 boost_program_options-vc141-mt-gd-x32-1_66.lib(value_semantic.obj) 中定义
1>boost_program_options-vc140-mt-gd.lib(boost_program_options-vc141-mt-gd-x32-1_68.dll) : error LNK2005: "public: virtual __thiscall boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper<char>(void)" (??1?$value_semantic_codecvt_helper@D@program_options@boost@@UAE@XZ) 已经在 boost_program_options-vc141-mt-gd-x32-1_66.lib(value_semantic.obj) 中定义
1>boost_program_options-vc140-mt-gd.lib(boost_program_options-vc141-mt-gd-x32-1_68.dll) : error LNK2005: "void __cdecl boost::program_options::validate(class boost::any &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,int)" (?validate@program_options@boost@@YAXAAVany@2@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@H@Z) 已经在 boost_program_options-vc141-mt-gd-x32-1_66.lib(value_semantic.obj) 中定义
1>boost_program_options-vc140-mt-gd.lib(boost_program_options-vc141-mt-gd-x32-1_68.dll) : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::program_options::to_internal(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?to_internal@program_options@boost@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) 已经在 boost_program_options-vc141-mt-gd-x32-1_66.lib(convert.obj) 中定义
1>  正在创建库 D:/code/VS/BabyCreator/eos_build/examples/Debug/fit-model-simple.lib 和对象 D:/code/VS/BabyCreator/eos_build/examples/Debug/fit-model-simple.exp
1>fit-model-simple.obj : error LNK2019: 无法解析的外部符号 "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread@cv@@YA?AVMat@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 __catch$_main$0 中被引用
1>fit-model-simple.obj : error LNK2019: 无法解析的外部符号 "bool __cdecl cv::imwrite(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::debug_build_guard::_InputArray const &,class std::vector<int,class std::allocator<int> > const &)" (?imwrite@cv@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@debug_build_guard@1@ABV?$vector@HV?$allocator@H@std@@@3@@Z),该符号在函数 __catch$_main$6 中被引用
1>D:\code\VS\BabyCreator\eos_build\examples\Debug\fit-model-simple.exe : fatal error LNK1120: 2 个无法解析的外部命令
@patrikhuber

This comment has been minimized.

Copy link
Owner

patrikhuber commented Jan 1, 2019

Hi,

I haven't tested your exact boost versions and OpenCV-4 yet, but these are linker errors and that's a bit weird. I'd guess it's something with your local configuration. I suggest you play around a bit with the packages and build system and ask on a help page like StackOverflow.com or something like that.

The compile error with CV_BGR2BGRA you can probably easily fix, you just need to find out what the equivalent in OpenCV-4 is. Possibly something similar and namespaced like cv::....

@huihut

This comment has been minimized.

Copy link
Author

huihut commented Jan 3, 2019

Thanks, I used the vcpkg build system to install boost and opencv, and then compile successfully.

@huihut huihut closed this Jan 3, 2019

@huihut

This comment has been minimized.

Copy link
Author

huihut commented Jan 3, 2019

I compiled successfully, but I can't run the fit-model. ( can't find some dll )

1546520602 1

When I add these missing dlls, the application does not start properly. ( error 0xc000007b )

2019-01-03_213217

2019-01-03_212959

@huihut huihut reopened this Jan 3, 2019

@Marc-Albrecht

This comment has been minimized.

Copy link

Marc-Albrecht commented Jan 8, 2019

Moin,

in case anyone stumbles across the CV_BGR2BGRA not being defined: In recent openCV versions that has been renamed to COLOR_BGR2BGRA. Since the namespace isn't used, just change the bit line 103 in Texture.hpp to "cv::COLOR_BGR2BGRA", that fixes the compilation error.

@patrikhuber

This comment has been minimized.

Copy link
Owner

patrikhuber commented Jan 19, 2019

The CV_BGR2BGRA error in Texture.hpp is fixed in the latest devel branch, where we removed the dependency of OpenCV in Texture (23d0755).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment