Bold title for a topic :)
Well, I 've updated my local wx installation to wx2.6.2/unicode and fixed all minor incompatibilities.
Except for one thing:
int someint;
wxString astr;
wxString anotherstr;
astr << _T("aval"); // ok
astr << anotherstr; // ok
astr << someint; // *not* ok
I can't stream numbers to wxString :shock:
Anyone else has seen this? Knows a workaround?
The only workaround I found is using wxString::Format() instead of streams but this would mean scanning the entire source tree to find where integers are streamed to wxString and alter the code...
Yiannis, mind explaining exactly why you can't use it? It throws a runtime error or what?
Nope, just it isn't actually added to the string:
wxString astr = "Test";
astr << 5;
astr == "Test", instead of "Test5"...
Yiannis: Mind giving us a particular filename / line no. ?
Sure. Here's the file I noticed the problem:
file: src/plugins/debuggergdb/gdb_commands.h
line: 189
m_Cmd << out << _T(":") << bp->line + 1;
m_Cmd << out << _T(":") << bp->line + 1;
Try this:
m_Cmd << out << _T(":") << (bp->line + 1);
Or this:
m_Cmd << out << _T(":");
m_Cmd << (bp->line + 1);
Or this:
(m_Cmd << out << _T(":")) << (bp->line + 1);
And tell us what happens.
Just curious, but does this work-around work?:
std::string str;
str << "Hi" << 5;
wxString str_new(_T(str));
Please notice that I've used default std::string for the first one.
(I cannot test it at the moment since I am at work.)
Morten.
Just curious, but does this work-around work?:
std::string str;
str << "Hi" << 5;
wxString str_new(_T(str));
Please notice that I've used default std::string for the first one.
(I cannot test it at the moment since I am at work.)
Morten.
That wont work because std::string doesn't have formatting -- you'd use a stringstream for that:
std::basic_stringstream<wxChar> ss;
ss << "Hi" << 5;
wxString str_new( ss.str() );
( because iostreams keep all the formatting information in istream and ostream, to avoid excessive duplication )
Note that I do not think this would be a good solution.
using the latest rocket engeeniering and the post above I developed this fix, I suppose its not the best solution, but if someone wants a working debugger with wx-2.6.2 and knows nothing about codeblocks it should be enough:
in /src/plugins/debuggergdb/gdb_commands.h , lines ~ 200 if (!m_BP->temporary)
m_Cmd << _T("break ");
else
m_Cmd << _T("tbreak ");
++ wxString s; s.Printf(_("%d"), m_BP->line + 1);
++ m_Cmd << out << _T(":") << s;
-- m_Cmd << out << _T(":") << m_BP->line + 1;
}
EDIT: the debugger is working now, a pity though it's not highlighting the actual line, nor any other line (breakpoint line, error line)
In http://forums.codeblocks.org/index.php?topic=1693.0 280Z28 might have stated a solution for the unicode problem. Look at this:
wxString str;
str.Printf(_T("MyString%d"), 5);
This should result in a unicode compatible "MyString5". Does this help?
Morten.