I beg your pardon if these questions are posted already. I am using wx in unicode, so when I try to convert a char[] static variable to unicode, I get errors:
// This line in MainFrame.cpp
wxT(AutoVersion::YEAR)
// generate these errors:
MainFrame.cpp:344: error: `LAutoVersion' has not been declared
You don't have to beg anything, is fine, in fact, is a good question. Answering your question, well I tried to make the plug in general with variables using C/C++ standards, for convenience.
![Smiley :)](https://forums.codeblocks.org/Smileys/default/smiley.gif)
I personally use these custom functions using a wxwidgets compiled as unicode on linux and windows without any problems.
//wxString to std::string
string ws2s(wxString as){
return string(as.mb_str(wxConvISO8859_1));
}
//std::string to wxString
wxString s2ws(string s){
return wxString((s).c_str(),wxConvISO8859_1);
}
//C string to wxString
wxString cs2ws(const char* s){
return wxString(s,wxConvISO8859_1);
}
MainFrame.cpp:344: error: `YEAR' was not declared in this scope
MainFrame.cpp:344: warning: unused variable 'YEAR'
// And not used variables in version.h generate warnings:
.\version.h:9: warning: 'AutoVersion::YEAR' defined but not used
.\version.h:10: warning: 'AutoVersion::UBUNTU_VERSION_STYLE' defined but not used
//...
I think, warnings could be avoided if the plugin generated a class instead of a namespace.
Good Idea
![Smiley :)](https://forums.codeblocks.org/Smileys/default/smiley.gif)
I doesn't thought that. Well I will leave the namespace, for some good reasons recommended by killerbot, and add a static class inside, named VersionInfo (or something shorter, I don't know). So it will be like this:
AutoVersion::VersionInfo::Major
or
using namesapce AutoVersion;
VersionInfo::Major
Those warnings where peacing me off too
![Tongue :P](https://forums.codeblocks.org/Smileys/default/tongue.gif)
But I don't know how to do it with the C header version, to stop the warnings from coming. May be with a struct, i don't remember if struct's could be initialized on C. Well create some struct interface, declare a variable of class struct and initialize the values there for the users to use.
I will like to know the opinions of the people using the plug in before changing the code. So my eyes and ears are open
![Smiley :)](https://forums.codeblocks.org/Smileys/default/smiley.gif)