C++ wxDVC渲染器的Xcode编译失败
全部, 上面的代码会产生很多错误,例如:C++ wxDVC渲染器的Xcode编译失败,c++,macos,wxwidgets,renderer,C++,Macos,Wxwidgets,Renderer,全部, 上面的代码会产生很多错误,例如: #ifdef __WXOSX__ #include "wx/toplevel.h" #include "wx/font.h" #include "wx/settings.h" #include "wx/utils.h" #include "wx/osx/private.h" #include "wx/osx/private/available.h" #include "wx/osx/cocoa/dataview.h" #include "wx/rende
#ifdef __WXOSX__
#include "wx/toplevel.h"
#include "wx/font.h"
#include "wx/settings.h"
#include "wx/utils.h"
#include "wx/osx/private.h"
#include "wx/osx/private/available.h"
#include "wx/osx/cocoa/dataview.h"
#include "wx/renderer.h"
#include "wx/stopwatch.h"
#include "wx/dcgraph.h"
#endif
class SortColumnRenderer
: public wxDataViewRenderer
{
public:
explicit SortColumnRenderer(
wxCheckBoxState state = wxCHK_CHECKED,
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int align = wxDVR_DEFAULT_ALIGNMENT)
: wxDataViewRenderer( GetDefaultType(), mode, mode ), m_checkedState(state)
{
m_allow3rdStateForUser = false;
m_value = "Ascending";
NSButtonCell* cell;
cell = [[NSButtonCell alloc] init];
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(GetAlignment())];
[cell setButtonType: NSSwitchButton];
[cell setImagePosition:NSImageLeft];
[cell setAllowsMixedState:YES];
SetNativeData(new wxDataViewRendererNativeData( cell ) );
[cell release];
};
};
来自#include“wx/osx/cocoa/dataview.h”
如果我发表评论,包括:
Expected unqualified-id NSObjCRuntime.h
尝试导入AppKit/NSButtonCell.h时,会产生与上面相同的错误集:预期为unqualified-id..
我试图模仿wxCheckIconTextRenderer中的代码,但没有图标部分
有人有主意吗
蒂亚 > P>你需要使用Objto-C编译代码,即将它放在一个文件中,如果你不想明确使用<代码> -X/COD>编译器选项,那么你就要使用<代码> .MM< /COD>扩展。你是否将C++的Obj-C代码编译成C++?Vadim,我想我是。因为我把这个代码放在C++源代码里面。我不应该那样做,对吗?有没有关于如何避免这种情况的建议?或者如何在没有图标的情况下使用wxCheckIconTextRenderer?
Unknown type name 'NSButtonCell'; did you mean 'NSButton'?