wxWidgets 和 boost::p roperty_tree 之间的冲突
Conflict between wxWidgets and boost::property_tree
我想在wxWidgets应用程序中使用boost::p roperty_tree。
但是当我添加行时
#include <boost/property_tree/ptree.hpp>
到一个简单的wxWidgets,我突然得到编译错误:
||=== Build: Release in pulley_client_gui (compiler: GNU GCC Compiler) ===|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|38|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|69|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|94|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|111|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|311|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h||In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':|
C:UsersJamescodewxWidgets-3.0.1includewxmswwinundef.h|324|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|
这似乎表明 wxWidgets 方法无法再处理 UTF8 参数,转换为 UTF16 的能力已被 boost 头文件破坏。
似乎UNICODE
定义不一致,即当 Boost 标头中包含 <windows.h>
时定义(或不定义),而当包含 wxWidgets 标头时未定义(或正在)。
为了防止这种情况发生,建议的解决方案是在 make 或项目文件中定义UNICODE
,以便在命令行上定义它。您可能已经在那里定义了_UNICODE
(如果使用 MSVS 项目),但这只会影响 CRT 标头,并且您也需要UNICODE
才能<windows.h>
。
找到了解决方法。 如果我在 wxWidgets 标头之后包含提升标头,则编译成功。
相关文章:
- C++中std::resize(n)和std::shrink_to_fit之间的区别
- int(c) 和 c-'0' 之间的区别。C++
- 在cuda线程之间共享大量常量数据
- 在c代码之间共享数据的最佳方式
- Mix_Init和Mix_OpenAudio SDL之间的区别是什么
- C++ 使用 assign 函数的字符串与直接使用 '=' 更改值的字符串之间的区别
- VSOMEIP-2个设备之间的通信(TCP/UDP)不工作
- std::atomic和std::condition_variable wait,notify_*方法之间的区别
- 大小相等但成员数量不同的结构之间的性能差异
- 类与私有变量的其他类之间的线程安全性
- 如何在cpp文件之间切换窗口?在Qt中
- 线程之间的布尔停止信号
- 我是C++编程的新手,这些代码之间有什么区别,我应该使用哪一个
- 在 const 函数中通过引用和指针返回之间的区别
- 我想知道长双倍和双倍之间的区别
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 在两台机器之间进行时间戳的最佳c++chrono函数是什么
- 使用.find函数在c++中查找字符和另一个字符之间的大小
- 构造函数和转换运算符之间的重载解析
- OOP:设计一个树,在Node类和tree类之间划分功能