xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.11k stars 784 forks source link

xmake编译qt和opencv,link库出现问题 #4531

Closed BarryArch closed 10 months ago

BarryArch commented 10 months ago

Xmake 版本

2.8.5

操作系统版本和架构

windows 11 23H2

描述问题

  1. 使用xmake创建cpp程序直接编译没问题
  2. 使用的环境是xmake f --vs=2015
  3. 使用xrepo安装opencv, 编译opencv 的 helloworld 程序, 没问题
  4. 使用xmake创建qt widgetapp 之间编译没问题
  5. 使用xmake 创建qt widgetapp , 同时引入opencv库,编译出错:
    error: opencv_highgui480.lib(window.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_highgui480.lib(window_w32.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_highgui480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_highgui480.lib(backend.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(loadsave.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_base.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_bmp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_sunras.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_jpeg.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_pxm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_pfm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_tiff.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_png.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_webp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_hdr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(grfmt_pam.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(exif.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(utils.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(bitstrm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgcodecs480.lib(rgbe.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(resize.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(demosaicing.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_lab.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_hsv.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_rgb.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_yuv.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(resize.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(resize.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(opencl_kernels_imgproc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj     
    opencv_imgproc480.lib(color_hsv.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_hsv.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(tables.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_rgb.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_rgb.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_yuv.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_imgproc480.lib(color_yuv.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(matrix.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(system.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(matrix_wrap.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(trace.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(opengl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(logger.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(check.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(convert.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(convert_scale.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj        
    opencv_core480.lib(matrix_transform.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(array.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(matrix_c.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(datafile.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(filesystem.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(copy.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(channels.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(merge.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(ocl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(umatrix.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(parallel.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(buffer_area.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(softfloat.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(mathfuncs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(alloc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(matrix_iterator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(gl_core_3_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(opencl_core.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(logtagmanager.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(convert.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(opencl_kernels_core.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(convert_scale.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(datastructs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(tables.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(matrix_operations.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(kmeans.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(glob.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(merge.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(rand.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(parallel.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(mathfuncs_core.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj       
    opencv_core480.lib(arithm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(out.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(logtagconfigparser.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(sum.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(norm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(mathfuncs_core.avx.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(mathfuncs_core.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(arithm.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(sum.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(minmax.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(stat.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(arithm.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(arithm.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(stat.sse4_2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    opencv_core480.lib(stat.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(ios.obj) : error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std@@SAXPEAV12@@Z) already defined in msvcprt.lib(MSVCP140.
    dll)
    libcpmt.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z) already defined in msvcpr
    t.lib(MSVCP140.dll)
    libcpmt.lib(locale0.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(locale0.obj) : error LNK2005: "void __cdecl std::_Facet_Register(class std::_Facet_base *)" (?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z) already defined in msvcprt.lib(locale0_i
    mplib.obj)
    libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ) already
    defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z) already defined in msvcprt.
    lib(MSVCP140.dll)
    libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z) already
    defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z) already defined in msvcp
    rt.lib(MSVCP140.dll)
    libcpmt.lib(cerr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(cout.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(iosptrs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(locale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xlock.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xlock.obj) : error LNK2005: "public: __cdecl std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QEAA@H@Z) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xlock.obj) : error LNK2005: "public: __cdecl std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QEAA@XZ) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xbad_function_call(void)" (?_Xbad_function_call@std@@YAXXZ) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xinvalid_argument(char const *)" (?_Xinvalid_argument@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(wlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xdateord.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(xwctomb.obj) : error LNK2005: _Getcvt already defined in msvcprt.lib(MSVCP140.dll)
    libcpmt.lib(winapisupp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(StlCompareStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(winapinls.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(StlCompareStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(StlLCMapStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    libcpmt.lib(StlLCMapStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj
    LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

    ···

期待的结果

理论上应该是可以编译成功,或者在包添加的阶段就给出提示或者解决办法

工程配置

xmake.lua:

add_rules("mode.debug", "mode.release")
add_rules("plugin.compile_commands.autoupdate")
add_requires("opencv")

target("opencv_testui")
    add_rules("qt.widgetapp")
    add_packages("opencv")
    add_files("src/main.cpp")

main.cpp :

#include <opencv2/opencv.hpp>
#include <QDebug>

int main(int argc, char** argv)
{
   cv::Mat img = cv::imread("d:\\1.png");

   if (img.empty())
   {
       printf("Could not load image...\n");
       return -1;
   }
   cv::namedWindow("Image", cv::WINDOW_NORMAL);
   cv::imshow("Image", img);
   cv::waitKey(0);

   return 0;
}

附加信息和错误日志

[ 50%]: linking.release opencv_testui.exe "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe" -nologo -dynamicbase -nxcompat -machine:x64 -libpath:C:\Qt\Qt5.9.6\5.9.6\msvc2015_64\lib -libpath:C:\Users\tom\AppData\Local.xmake\packages\o\opencv\4.8.0\69684747aed04b64833b165b90454f36\x64\vc14\staticlib /opt:ref /opt:icf opencv_phase_unwrapping480.lib opencv_surface_matching480.lib opencv_saliency480.lib opencv_wechat_qrcode480.lib opencv_mcc480.lib opencv_face480.lib opencv_img_hash480.lib opencv_videostab480.lib opencv_structured_light480.lib opencv_intensity_transform480.lib opencv_ccalib480.lib opencv_line_descriptor480.lib opencv_stereo480.lib opencv_dnn_objdetect480.lib opencv_dnn_superres480.lib opencv_fuzzy480.lib opencv_hfs480.lib opencv_rapid480.lib opencv_bgsegm480.lib opencv_bioinspired480.lib opencv_rgbd480.lib opencv_dpm480.lib opencv_aruco480.lib opencv_reg480.lib opencv_tracking480.lib opencv_datasets480.lib opencv_xfeatures2d480.lib opencv_shape480.lib opencv_superres480.lib opencv_plot480.lib opencv_quality480.lib opencv_text480.lib opencv_optflow480.lib opencv_ximgproc480.lib opencv_xobjdetect480.lib opencv_xphoto480.lib opencv_stitching480.lib opencv_ml480.lib opencv_photo480.lib opencv_objdetect480.lib opencv_highgui480.lib opencv_videoio480.lib opencv_video480.lib opencv_calib3d480.lib opencv_dnn480.lib opencv_features2d480.lib opencv_flann480.lib opencv_imgcodecs480.lib opencv_imgproc480.lib opencv_core480.lib libjpeg-turbo.lib libpng.lib libprotobuf.lib libtiff.lib libwebp.lib quirc.lib zlib.lib Qt5Gui.lib Qt5Widgets.lib Qt5Core.lib qtfreetype.lib qtlibpng.lib qtmain.lib ole32.lib shell32.lib imm32.lib winmm.lib iphlpapi.lib gdi32.lib user32.lib glu32.lib opengl32.lib advapi32.lib comdlg32.lib ws2_32.lib -subsystem:windows -entry:mainCRTStartup -out:build\windows\x64\release\opencv_testui.exe build.objs\opencv_testui\windows\x64\release\src\main.cpp.obj error: @programdir\core\main.lua:314: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:320: @programdir\actions\build\kinds\binary.lua:74: @programdir\modules\core\tools\link.lua:175: opencv_highgui480.lib(window.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_highgui480.lib(window_w32.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_highgui480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_highgui480.lib(backend.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(loadsave.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_base.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_bmp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_sunras.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_jpeg.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_pxm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_pfm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_tiff.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_png.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_webp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_hdr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(grfmt_pam.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(exif.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(utils.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(bitstrm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgcodecs480.lib(rgbe.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(resize.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(demosaicing.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_lab.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_hsv.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_rgb.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_yuv.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(resize.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(resize.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(opencl_kernels_imgproc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_hsv.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_hsv.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(tables.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_rgb.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_rgb.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_yuv.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_imgproc480.lib(color_yuv.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(system.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix_wrap.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(trace.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(opengl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(logger.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(check.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(convert.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(convert_scale.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix_transform.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(array.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix_c.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(datafile.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(filesystem.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(copy.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(channels.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(merge.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(ocl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(umatrix.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(parallel.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(buffer_area.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(softfloat.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(mathfuncs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(cmake_pch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(alloc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix_iterator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(gl_core_3_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(opencl_core.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(logtagmanager.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(convert.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(opencl_kernels_core.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(convert_scale.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(datastructs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(tables.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(matrix_operations.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(kmeans.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(glob.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(merge.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(rand.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(parallel.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(mathfuncs_core.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(arithm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(out.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(logtagconfigparser.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(sum.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(norm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(mathfuncs_core.avx.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(mathfuncs_core.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(arithm.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(sum.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(minmax.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(stat.dispatch.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(arithm.sse4_1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(arithm.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(stat.sse4_2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj opencv_core480.lib(stat.avx2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(ios.obj) : error LNK2005: "public: static void cdecl std::ios_base::_Addstd(class std::ios_base )" (?_Addstd@ios_base@std@@SAXPEAV12@@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base )" (?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(locale0.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(locale0.obj) : error LNK2005: "void cdecl std::_Facet_Register(class std::_Facet_base )" (?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z) already defined in msvcprt.lib(locale0_implib.obj) libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(locale0.obj) : error LNK2005: "public: static void cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo ,char const )" (?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(cerr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(cout.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(iosptrs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(locale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xlock.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xlock.obj) : error LNK2005: "public: cdecl std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QEAA@H@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xlock.obj) : error LNK2005: "public: __cdecl std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QEAA@XZ) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xthrow.obj) : error LNK2005: "void cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xthrow.obj) : error LNK2005: "void cdecl std::_Xbad_function_call(void)" (?_Xbad_function_call@std@@YAXXZ) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xthrow.obj) : error LNK2005: "void cdecl std::_Xinvalid_argument(char const *)" (?_Xinvalid_argument@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xthrow.obj) : error LNK2005: "void cdecl std::_Xlength_error(char const )" (?_Xlength_error@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(xthrow.obj) : error LNK2005: "void __cdecl std::_Xout_of_range(char const )" (?_Xout_of_range@std@@YAXPEBD@Z) already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(wlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xdateord.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(xwctomb.obj) : error LNK2005: _Getcvt already defined in msvcprt.lib(MSVCP140.dll) libcpmt.lib(winapisupp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(StlCompareStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(winapinls.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(StlCompareStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(StlLCMapStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj libcpmt.lib(StlLCMapStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.cpp.obj LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library build\windows\x64\release\opencv_testui.exe : fatal error LNK1169: one or more multiply defined symbols found

stack traceback: [C]: in function 'error' [@programdir\core\base\os.lua:949]: [@programdir\modules\core\tools\link.lua:175]: in function 'catch' [@programdir\core\sandbox\modules\try.lua:123]: in function 'try' [@programdir\modules\core\tools\link.lua:150]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:280]: [@programdir\core\tool\linker.lua:221]: in function 'link' [@programdir\actions\build\kinds\binary.lua:74]: in function 'callback' [@programdir\modules\core\project\depend.lua:217]: in function 'on_changed' [@programdir\actions\build\kinds\binary.lua:55]: in function '_do_link_target' [@programdir\actions\build\kinds\binary.lua:105]: [@programdir\actions\build\kinds\binary.lua:132]: in function '_link_target' [@programdir\actions\build\kinds\binary.lua:160]: in function 'jobfunc' [@programdir\modules\async\runjobs.lua:237]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:280]: in function 'trycall' [@programdir\core\sandbox\modules\try.lua:117]: in function 'try' [@programdir\modules\async\runjobs.lua:220]: in function 'cotask' [@programdir\core\base\scheduler.lua:404]:

stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:949: in function 'os.raiselevel' (...tail calls...) @programdir\core\main.lua:314: in upvalue 'cotask' @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

Issues-translate-bot commented 10 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake compiles qt and opencv, and there is a problem with the link library

waruqi commented 10 months ago

全局设置下 set_runtimes("MD") 试试

Issues-translate-bot commented 10 months ago

Bot detected the issue body's language is not English, translate it automatically.


Try set_runtimes("MD") in global settings

BarryArch commented 10 months ago

好了,多谢!

Issues-translate-bot commented 10 months ago

Bot detected the issue body's language is not English, translate it automatically.


Okay, thank you!