Where did you get your wyWidgets from.
There should be a a third overload for operator[] in string.h (and array.h), if size_t is not unsigned int:
// operator versions of GetWriteableChar()
wxChar& operator[](int n)
{ return wxStringBase::at(n); }
wxChar& operator[](size_type n)
{ return wxStringBase::at(n); }
#ifndef wxSIZE_T_IS_UINT
wxChar& operator[](unsigned int n)
{ return wxStringBase::at(n); }
#endif // size_t != unsigned int
So I think our code should be valid in any cases.
The wxWidgets that I am using is a package associated with CentOS 5.5, x86_64. It may have come from rpmfusion, but I'm not certain of that. It is version 2.8.11, the current stable release from wxWidgets.
The odd part is that the original error arose from one of wx's own source files - /usr/include/wx-2.8/wx/filename.h. I found the fix to this through a simple Google search - described in my first post.
I looked into the wx string.h file and I see the same code section that you posted, specifically
// operator versions of GetWriteableChar()
wxChar& operator[](int n)
{ return wxStringBase::at(n); }
wxChar& operator[](size_type n)
{ return wxStringBase::at(n); }
#ifndef wxSIZE_T_IS_UINT
wxChar& operator[](unsigned int n)
{ return wxStringBase::at(n); }
#endif // size_t != unsigned int
I'm compiling with GCC 4.4.5 - not sure if that has any impact as I didn't check to see how or where wxSIZE_T_IS_UINT is or isn't defined.
The alternative that I am just beginning to try is to add another function to string.h:
wxChar& operator[](long n)
{ return wxStringBase::at(n); }
wxChar& operator[](unsigned int n)
{ return wxStringBase::at(n); }
Seems easier that changing all the instances where a long is passed in the Code::Blocks source.
Edit:
This seemed to fix the symptom and Code::Blocks is compiling nicely now. I'm unsure as to why this should occur to begin with. I haven't dug deep into the wx code or addressed that community just yet - that is my next task. From what I can find, this is a 64-bit issue, but again, I can't wrap my head around why it should be an issue. It seems that long, unsigned int, and size_t are all expected to exist as different function signatures.
Edit:
I verified that my wx package came from the epel repo, the Fedora/RedHat Enterprise Linux repository.
I tried it on CentOs 5.5 with wxGTK 2.8.10 from rpmforge and it works fine.
You can look into /usr/lib64/wx/include/gtk2-unicode-release-2.8/wx/setup.h to see whether wxSIZE_T_IS_UINT is defined or not.
It should be:
/* Define if size_t on your machine is the same type as unsigned int. */
/* #undef wxSIZE_T_IS_UINT */
/* Define if size_t on your machine is the same type as unsigned long. */
#define wxSIZE_T_IS_ULONG 1
on 64-bit systems.
It looks like the package is not configured or build correctly or the setup.h is from a 32-bit build (or a build on a 32-bit machine).
obfuscated@xlad ~ $ ls -l /usr/lib
lrwxrwxrwx 1 root root 5 26 я▌п╩п╦ 2008 /usr/lib -> lib64
He is correct :) or my gentoo amd64 system is broken :)