last day (14 days later) » 

1:30 PM
1
Q: Fixing mixed STL implementation with OpenCV

AttaqueProblem I am trying to get OpenCV up and running, but I ran into the same problem as this guy and this guy - I get linker errors when trying to build the project with the C++ interface, but with C interface the project builds. In the second link, the answer is "You're mixing different implement...

 
Can you show your #include? And your library path?
 
I added the changes I have made to the solution properties
I apologize. Since it was based on the other questions I linked, I did not think about it too much. This might be part of the problem, I have not had the need to use a different library than what is provided with VS. Could you maybe do the change?
 
as soon as your VS project is 32 bit, this should work
 
I completely agree Miki :) Unfortunately.. I can send the project to you if you would like give it a run?
 
@Attaque static or dynamic libs? I try setting up a new VS12 project
 
1:30 PM
 
works ok for me.. well, you're missing a waitKey(); in your C++ code, but that's not the issue here
 
I have no idea how to fix this then. Is it a problem that i have both vs12 and vs15 installed?
 
I have VS2008, 2010, 2012, and 2013 installed and works... :D
 
Could you maybe send me your working project? Just to make sure.. I know it's potentially dangerous but i trust you stranger! ;)
 
1:41 PM
nothing fancy about my solution... the same stuff you tried..
just start with an empty console application and added libs and include as you did
have you tried cleaning the solution and rebuild?
 
I have yes.. There must be something installed on my pc which causes a problem. Do you have the CUDA platform installed, because i suspect that it causes the problem?
 
no, but I don't think that's the problem
 
2:30 PM
Well i guess i will try and put a bounty up on the question. Unless you have any suggestions on what i could investigate?
 
if you have 5 minutes I could tell you step by step while you build up the solution
 
If you have the time, that would be great!
I am unfortunately in a place where i cannot skype with sound, but i can screenshare
 
no skype.. just here, I'll tell you each step
ok?
 
Perfect
 
Open VS 2012
new project
 
2:44 PM
yup
 
VIsual C++ / Win32 console application
 
y
 
next
check empty project
uncheck SDL
finish
 
done
 
add a cpp file under source fiels in solution explorer
 
2:46 PM
done
 
properties
VC++ Directories
Include Directories
edit and add
D:\libs\opencv-249\build\include
your path and OpenCV dir and 2410 for you
then library directories
 
Ok. For me that is C:\opencv\build\include
Just to be clear
you downloaded the exe file from opencv right, and didn't build it yourself?
 
D:\libs\opencv-249\build\x86\vc11\lib
yes
Linker -> Input
 
y
 
add everything *d.lib in the vc11\lib
opencv_contrib249d.lib
opencv_stitching249d.lib
opencv_videostab249d.lib
opencv_superres249d.lib
opencv_nonfree249d.lib
opencv_gpu249d.lib
opencv_ocl249d.lib
opencv_legacy249d.lib
opencv_ts249d.lib
opencv_calib3d249d.lib
opencv_features2d249d.lib
opencv_objdetect249d.lib
opencv_highgui249d.lib
opencv_video249d.lib
opencv_photo249d.lib
opencv_imgproc249d.lib
opencv_flann249d.lib
opencv_ml249d.lib
opencv_core249d.lib
in additional dependencies
 
2:50 PM
yes. For me that is:
opencv_calib3d2410d.lib
opencv_contrib2410d.lib
opencv_core2410d.lib
opencv_features2d2410d.lib
opencv_flann2410d.lib
opencv_gpu2410d.lib
opencv_highgui2410d.lib
opencv_imgproc2410d.lib
opencv_legacy2410d.lib
opencv_ml2410d.lib
opencv_nonfree2410d.lib
opencv_objdetect2410d.lib
opencv_ocl2410d.lib
opencv_photo2410d.lib
opencv_stitching2410d.lib
opencv_superres2410d.lib
opencv_ts2410d.lib
opencv_video2410d.lib
opencv_videostab2410d.lib
 
ok ok save etc...
copy this into your cpp
#include <opencv2\opencv.hpp>
using namespace cv;

int main()
{
Mat3b img(200,200,Vec3b(0,255,0));
imshow("img", img);
waitKey();
return 0;
}
should build, but not run due to missing dll
right?
 
1>Source.obj : error LNK2019: unresolved external symbol "private: char * __thiscall cv::String::allocate(unsigned int)" (?allocate@String@cv@@AAEPADI@Z) referenced in function "public: __thiscall cv::String::String(char const *)" (??0String@cv@@QAE@PBD@Z)
1>Source.obj : error LNK2019: unresolved external symbol "private: void __thiscall cv::String::deallocate(void)" (?deallocate@String@cv@@AAEXXZ) referenced in function "public: __thiscall cv::String::~String(void)" (??1String@cv@@QAE@XZ)
1>Source.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class cv::String con
I get the build errors...
So annoying.
I appreciate your patience though :/
 
well, so I've not much more to tell you :D
 
But this is only with opencv. Just included libtiff in another project, and same procedure you know. no problems.
I will download opencv again, in case there was some problems.. Unlikely, but what to do :) Thank you for your help Miki
 
Visual studio project is x86 right?
 
3:01 PM
yes, win32
You also have a env variable to the bin folder right?
C:\opencv\build\x86\vc11\bin
 
yes, don't know why you need that though
ah sorry, no, I don't have it
why you need that?
 
I'm not sure, but the tutorial on opencv said so
I'm trying to delete it
 
restart VS then
 
No difference :/
 
so I don't know..
good luck
 
3:13 PM
I got it... I even just told you which version i was using.. 3.0.. However i was linking with 2.41 (which apparently was still left in the folder)
Thank you so much Miki!
 
that make sense... :D
 
Please leave an answer on the question, telling me that i'm linking for 2.41 instead of 3.0 :)
I am confused whereas to why i could build and run it with c code? :S
 
actually all information to get to this conclusion were already present in the question.. :D
 
yes.. oh yes it was... Haha, so obvious now
 
probably that's because C code is the old legacy, and not changed among versions
 
3:21 PM
Okay, maybe
 
well..we're good to go now :D
bye!
 
Shall we clean out some of the talk we had in the question?
 
no need... are just comments
 
good, good. Thank you again, and have nice day!
 

last day (14 days later) »