Skip to content

4.5.2 static library, highgui module compile failure LNK2019 #19870

@LiuPeiqiCN

Description

@LiuPeiqiCN
System information (version)
  • OpenCV => 4.5.2 static library
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2019
Detailed description

I have a application use highgui, but when I upgrade opencv from 451 to 452, a LNK2019 error come out:

1>opencv_highgui452.lib(window.obj) : error LNK2019: 无法解析的外部符号【unresolved external symbol】 "double __cdecl cvGetPropVsync_W32(char const *)" (?cvGetPropVsync_W32@@YANPEBD@Z),函数【Function】 "double __cdecl cv::getWindowProperty(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?getWindowProperty@cv@@YANAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 中引用了该符号 1>opencv_highgui452.lib(window.obj) : error LNK2019: 无法解析的外部符号 "void __cdecl cvSetPropVsync_W32(char const *,bool)" (?cvSetPropVsync_W32@@YAXPEBD_N@Z),函数 "void __cdecl cv::setWindowProperty(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,double)" (?setWindowProperty@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HN@Z) 中引用了该符号

cvGetPropVsync_W32 and cvSetPropVsync_W32 is define in highgui/src/precomp.hpp, both of them is only defined but without implement.

double cvGetPropVsync_W32(const char* name);
void cvSetPropVsync_W32(const char* name, const bool enabled);

So I delete them in opencv source code and build highgui module again, then LNK2019 don't happen and complie success:

  1. highgui/src/window.cpp, Line195
//case cv::WND_PROP_VSYNC:
//    #if defined (HAVE_WIN32UI)
//        cvSetPropVsync_W32(name, (prop_value != 0));
//    #else
//        // not implemented yet for other toolkits
//    #endif
//break;
  1. highgui/src/window.cpp, Line193
//case cv::WND_PROP_VSYNC:
//    #if defined (HAVE_WIN32UI)
//        return cvGetPropVsync_W32(name);
//    #else
//        return -1;
//    #endif
//break;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions