I am trying to use cv_bridge in my project on Windows 10 using Visual Studio 2017. When I try to compile my code, I get the following errors:
Error LNK2005 "public: __cdecl std::exception::exception(class std::exception const &)" (??0exception@std@@QEAA@AEBV01@@Z) already defined in cv_bridge.lib(cv_bridge.dll) my_project_name C:\my_project_path\MSVCRTD.lib(throw_bad_alloc.obj) Error LNK2005 "public: virtual char const * __cdecl std::exception::what(void)const " (?what@exception@std@@UEBAPEBDXZ) already defined in cv_bridge.lib(cv_bridge.dll) my_project_name C:\my_project_path\MSVCRTD.lib(throw_bad_alloc.obj)
opencv2/core.hpp define a class called Exception. I have to link OpenCV in order to link with cv_bridge so I'm not sure how to get around this issue other than commenting the class out in
cv_bridge.hand rebuilding cv_bridge from source, but I've used cv_bridge when building catkin packages in Ubuntu and never ran into this problem so I'm hesitant to rebuild it.
I am not creating a ROS package in this case - I am building a DLL to call in Unity+ROS#. Maybe the ROS build scripts are able to handle this issue and Visual Studio cannot?
Is this just some issue with my project settings in VS17? Or will I need to rebuild cv_bridge for this project? Or something else?
Post score: 0