opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
78.14k stars 55.72k forks source link

bug when build opencv: QT 6.7, UNICODE, __itt_domain_create #25543

Open sunqian119 opened 4 months ago

sunqian119 commented 4 months ago

System Information

OpenCV: 4.9.0 Operating System / Platform: WIN 11 Home Compiler & compiler version: MSVC 1939 CMake version: 3.29.2

Detailed description

I choose "WITH_QT" (version 6.7.0) and "build_opencv_world" in cmake-gui, part of error logs are as follows:

D:\OPENCV\opencv-4.9.0\modules\core\src\trace.cpp(211,46): error C2664: “itt_domain (const wchar_t )”: 无法将参数 1 从“const char [12]”转换为“const wchar_t *” D:\OPENCV\opencv-4.9.0\modules\core\src\trace.cpp(211,46): 指向的类型不相关; 转换需要 reinterpret_cast、C 样式强制转换或带圆括号的函数样式强制转换 D:\OPENCV\opencv-4.9.0\modules\core\src\trace.cpp(241,61): error C2664: “itt_string_handle (const wchar_t )”: 无法将参数 1 从“const char const ”转换为“const wchar_t ” D:\OPENCV\opencv-4.9.0\modules\core\src\trace.cpp(241,61): 指向的类型不相关; 转换需要 reinterpret_cast、C 样式强制转换或带圆括号的函数样式强制转换

1 2 3

However, everything is fine when I only choose "build_opencv_world" or "WITH_QT". And in QT assistant, I find that "In Qt 6, the UNICODE and _UNICODE compiler definitions are set by default for targets that link against Qt modules".

Steps to reproduce

choose "WITH_QT" (version 6.7.0) and "build_opencv_world" in cmake-gui

Issue submission checklist

opencv-alalek commented 4 months ago

There are several options:

sunqian119 commented 4 months ago

There are several options:

Thanks anyway. I have added the command at this place and it worked. 1 Maybe the only one solution is to disable the UNICODE. :sweat_smile:

opencv-alalek commented 4 months ago

There is still a problem in source code, so lets keep this issue open.