Error

C++博客 首页 新随笔 联系 聚合 管理
  217 Posts :: 61 Stories :: 32 Comments :: 0 Trackbacks

找到这样的代码修改了以后还是不行

if (NOT TARGET Qt5::Core)
    add_library(Qt5::Core SHARED IMPORTED)

    _populate_imported_target_properties(DEBUG "Qt5Cored.dll" "Qt5Cored.lib" )

 

    _populate_imported_target_properties(RELEASE "Qt5Core.dll" "Qt5Core.lib" )

    # add by enic
    _populate_imported_target_properties(RELWITHDEBINFO "Qt5Core.dll" "Qt5Core.lib" )

endif()

 

 

看来和编译器编译出来的格式相关了

3>Build started 2013/4/13 22:21:33.
3>qtmaind.lib(qtmain_win.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in MainEntry.obj
3>qtmaind.lib(qtmain_win.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in MainEntry.obj
3>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
3>F:\working_space\qt\cmake_qt_learn\cmake_result\RelWithDebInfo\qtUsingCMake.exe : fatal error LNK1319: 2 mismatches detected

 

仔细一看,不是,,,泥马,原来是qtmain搞的鬼,,,

继续找,,,

if (NOT TARGET Qt5::WinMain)
    add_library(Qt5::WinMain STATIC IMPORTED)

    set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
    set_target_properties(Qt5::WinMain PROPERTIES
        IMPORTED_LOCATION_DEBUG "${_qt5_corelib_install_prefix}/lib/qtmaind.lib"
    )

    set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
    set_target_properties(Qt5::WinMain PROPERTIES
        IMPORTED_LOCATION_RELEASE "${_qt5_corelib_install_prefix}/lib/qtmain.lib"
    )
   
    # add by enic
    set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
    set_target_properties(Qt5::WinMain PROPERTIES
        IMPORTED_LOCATION_RELEASE "${_qt5_corelib_install_prefix}/lib/qtmain.lib"
    )
endif()

 

这里还藏着在,,,

继续报错:

3>Build started 2013/4/13 22:25:24.
3>qtmaind.lib(qtmain_win.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in MainEntry.obj
3>qtmaind.lib(qtmain_win.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in MainEntry.obj
3>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
3>F:\working_space\qt\cmake_qt_learn\cmake_result\RelWithDebInfo\qtUsingCMake.exe : fatal error LNK1319: 2 mismatches detected

 

这下感觉在想找*.cmake找到就比较麻烦了,,,

继续分析

set_target_properties(Qt5::WinMain PROPERTIES
IMPORTED_LOCATION_RELEASE "${_qt5_corelib_install_prefix}/lib/qtmain.lib"
)

 

这东西可疑,,,

改IMPORTED_LOCATION_RELWITHDEBINFO,rebuild,搞定,,,

posted on 2013-04-13 22:33 Enic 阅读(1098) 评论(0)  编辑 收藏 引用 所属分类: QT

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理