【问题标题】:Qt cannot convert 'const wchar_t*' to 'TCHAR*'Qt 无法将 'const wchar_t*' 转换为 'TCHAR*'
【发布时间】:2013-04-19 17:45:38
【问题描述】:

我将项目从 Visual Studio 转移到 QT,并且在项目构建时 - 显示错误。如何在不对代码进行重大更改的情况下修复它们?

cannot convert 'const wchar_t*' to 'TCHAR*'
cannot convert '_TCHAR*' to 'const wchar_t*'
cannot convert 'const wchar_t [15]' to 'TCHAR*'
cannot convert 'TCHAR*' to 'const wchar_t*'
...

几十个这样的错误。

PS 奇怪的是,谷歌在这个问题上没有任何有用的结果。

【问题讨论】:

    标签: qt wchar-t tchar


    【解决方案1】:

    你的新版本知道TCHAR* 吗?这是一个特定于 Windows 的“功能”

    【讨论】:

    • 是的。 tchar.h typedef char TCHAR;
    • 我会尽可能使用 Qt 字符串类,并在需要调用外部 api 时从本机类型转换为。 TCHAR 几乎总是一个坏主意——即使只是在 Windows 上。
    • 很多错误。我需要一个简单的解决方案。我不能使用 QT 类,因为应用程序依赖于 QT 库
    猜你喜欢
    • 2017-03-31
    • 1970-01-01
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    • 2010-11-03
    • 2015-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多