Different between wxMSW242 and wxGTK242?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Sirius
Earned a small fee
Earned a small fee
Posts: 15
Joined: Tue Sep 07, 2004 3:18 am
Contact:

Different between wxMSW242 and wxGTK242?

Post by Sirius »

Recently I tried to compile a program in Linux enviroment-wxGTK 242, which I created with ans tested with wxMSW 2.4.2. I found that there are some different between these 2 Port:



My code:

Code: Select all

ShowErr(wxString("Price or Deposit is invalid"));
...
...

void myDialog::ShowErr(wxString& strErr) {
    wxMessageDialog dlgMsg(this, strErr, "caption",  wxOK|wxICON_EXCLAMATION);
    dlgMsg.ShowModal();
}

Under wxMSW, it can compile without any error reported. But in wxGTK, it
complaint that is an error at this line of code:

Code: Select all

ShowErr(wxString("Price or Deposit is invalid"));
So I got to change my code to this:

Code: Select all

wxString strErr;
strErr = "Price or Deposit is invalid";
ShowErr(strErr);

Is this a normal case? Which one is correct?


Thanks
--------
Sirius


wxMSW 2.4.2
WinXP, VC++ 6.0

wxGTK 2.4.2
Debian, gcc 3.3.3
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
Try again with using ShowErr(wxT("Price or Deposit is invalid"));, maybe that'll work.
Is this a normal case? Which one is correct?
Both are correct and can be used. gcc is slightly( :D ) more strit about standards than VC++ is.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco »

If you are using the GTK2 version it uses Unicode so you'll need to surround all of your string literals as Sirius has shown.
Sirius
Earned a small fee
Earned a small fee
Posts: 15
Joined: Tue Sep 07, 2004 3:18 am
Contact:

Post by Sirius »

Code: Select all

void myDialog::ShowErr(const wxString& strErr);
I add a 'const' for the member method, and everything is fine now :)

Thank you
OS: WinXP
wxMSW 2.5.2, VC 6.0

OS: Debian sarge
wxGTK 2.4.2, gcc 3.3.3

I like Linux and C++
leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio »

I'll just comment about wxGTK-2.4.2
I see you are using wxMSW-2.5.2 and wxGTK-2.4.2, I highly suggest using wxGTK-2.5.3 or newer due to very significant goodness in there compared to 2.4.2 including many bugfixes. I got tens of bugs fixed in my project that were wxGTK specific just by switching to 2.5.3 (CVS HEAD to be more exact, but at the time 2.5.3 was just about to come out).
2.5 series might not be API stable, especially for some new classes, but it is quite stable codewise. In case of wxGTK more stable than 2.4.2 in places.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Post Reply