Reputation: 21
Overall I am trying to link an opencv test program with the opencv libraries I compiled using 64-bit visual studio 2010 professional. An example error is:
1>webcamtest.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " (?isOpened@VideoCapture@cv@@UBE_NXZ)
The question is why __thiscall, when opencv_highui249.dll which it is linked with contains
Symbol name : ?isOpened@VideoWriter@cv@@UEBA_NXZ (public: virtual bool __cdecl cv::VideoWriter::isOpened(void)const )
__cdecl makes sense, which suggests that the library is built correctly. When linking the test program, opencv_highui249.dll is being searched, so the build flags appear to be correct, but apparently I am missing something?
Upvotes: 2
Views: 1682
Reputation: 14119
Are you sure you used x64 libraries?
Microsoft reduced the calling conventions in x64. See here. Basically everything is now __fastcall
.
The compiler can still use __thiscall
but it is ignored(MSDN link). So your test program is fine but your library looks wrong.
Upvotes: 1
Reputation: 26171
__thiscall
is the default for class member functions in MSVC, you either need to compile OpenCV with the same settings, or explicitly use __cdecl
in the header definitions.
Upvotes: 0
Reputation: 22591
__thiscall
is the default calling convention in VS for member functions of classes. Perhaps the header files are missing the __cdecl
specifier, or the compile flags are incorrectly set so a relevant #define for it isn't being set.
Upvotes: 0