I am mystified and stymied by a failure to compile a .cpp program written with codeblocks and
wxSmith.
I am trying to save a graph. The variable "paper" has been defined by
wxBitmap *paper = new wxBitmap( 2000,1236);
With the line
paper->SaveFile( _T("GwxGraph.png"), wxBITMAP_TYPE_PNG, (wxPalette*)NULL );
the program compiles and works just fine, but I want to make the name of
the file holding holding the graph variable. So I start with just
char filename[32];
strcpy(filename,"GwxGraph.png")
paper->SaveFile( _T(filename), wxBITMAP_TYPE_PNG,(wxPalette*)NULL );
but the program won't even compile. It stops with the red error marker on the line marked with
===>>> in the text shown below and taken from wxChar.h.
The error message is that LGwxGraph.png is not declared, which is indeed true, but why
should it be declared?
Any suggestions about how I could make the filename of the graph a variable would be most
appreciated.
Maybe this question belongs over on the wxWidgets forum, but I have gotten such excellent here on
Code::Blocks, I thought to try first here.
==========================================================
From wxChar.h
#define wxT(x) wxCONCAT_HELPER(L, x)
/* ---------------------------------------------------------------------------- */
/* define wxT() and related macros */
/* ---------------------------------------------------------------------------- */
#if wxUSE_UNICODE
/* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
===>>> #define wxT(x) wxCONCAT_HELPER(L, x)
#else /* !Unicode */
#define wxT(x) x
#endif /* Unicode/!Unicode */
/*
This macro is defined for forward compatibility with wxWidgets 3. It should
be used in the places where wxWidgets 2 API requires wxT() (in Unicode
build) but wxWidgets 3 doesn't accept it, e.g. wxCmdLineEntryDesc struct
elements initializers.
*/
#define wxT_2(x) wxT(x)
/*
We define _T() as a synonym of wxT() for backwards compatibility and also
for the benefit of Windows programmers used to it. But this identifier is a
reserved one and this does create problems in practice, notably with Sun CC
which uses it in the recent versions of its standard headers. So avoid
defining it for this compiler at all, unless it was explicitly requested by
predefining wxNEEDS__T macro before including this header or if we're
building wx itself which does need and compiles fine thanks to the special
workarounds for Sun CC in wx/{before,after}std.h.
*/