VC中使用wxWidgets 出现的编译错误 error C2059: syntax error : 'constant' 解决

From WxWiki

在使用VC编译wxWidgets时,很多新手出现的编译错误:error C2059: syntax error : 'constant'

First, look at Compiling A WxWidgets Application to see what you need for your new project settings.
首先,检查您的WxWidgets工程设置属性
If you plan to use both MFC and wxWidgets (and are using stdafx.h), make sure to have "include <wx/wx.h>" above the MFC include lines. Otherwise, you may get errors about a "constant" in the CreateDialog function.
如果您计划使用MFC 如(CEdit, CString之类的),确保您的头文件中加入了include <wx/wx.h>,否则您可能会得到类似 "'constant' in the CreateDialog function"的编译错误。
Unlike MFC's CString::Format function, the wxString::Format function is a static member function. This means that calling "myStringInstance.Format(...)" will return the formatted text in a new wxString rather than change the string in the myStringInstance variable. You might be able to get away with a search and replace of ".Format(" to " = wxString::Format(" or ".Printf(" when porting your application.

There is a guide for porting an MFC application to wxWidgets.
以下是一个例子:从MFC程序移植为wxWidgets (Windows)程序。
http://wiki.wxwidgets.org/WxWidgets_For_MFC_Programmers#Dialog_Data_Handling

See Porting MFC applications to Linux.

至于从MFC程序移植为wxWidgets (Linux)程序,请看http://www-106.ibm.com/developerworks/library/l-mfc/?n-l-4182

最后总结:亲们,VC的wxWidgets项目出现error C2059编译错误时,只要确保您的头文件中加入include <wx/wx.h>就可以啦

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值